Difference between revisions of "General"
m |
m |
||
(8 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
=== Network Setup (ent 7) === | === Network Setup (ent 7) === | ||
− | 1. determine interface and connection name setup | + | 1. determine interface and connection name setup for the subsequent nmcli commands, use what it shows for the Connection name (Device and Connection name are normally the same, but not always the same - this needs to be checked to verify what to use).<br> |
+ | Note: "show" is a default argument in most cases, and does not need to be specified, unless other "show" arguments/details are needed (as in: nmcli dev show eno16777728) | ||
# nmcli dev | # nmcli dev | ||
2. configure the interface, IP, and gateway (defaults to "automatic" (DHCP), change to "manual" to be able to configure static parameters - settings saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/, in this example; ifcfg-eno16777728) | 2. configure the interface, IP, and gateway (defaults to "automatic" (DHCP), change to "manual" to be able to configure static parameters - settings saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/, in this example; ifcfg-eno16777728) | ||
− | |||
# nmcli con mod eno16777728 ipv4.method manual ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1 | # nmcli con mod eno16777728 ipv4.method manual ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1 | ||
− | 3. configure hostname (saved in /etc/hostname) and domain (saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/) | + | 3. configure hostname (saved in /etc/hostname) and domain (saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/ and in /etc/resolv.conf) |
# nmcli gen hostname ks-c7a.lab.example.com | # nmcli gen hostname ks-c7a.lab.example.com | ||
# nmcli con mod eno16777728 ipv4.dns-search lab.example.com | # nmcli con mod eno16777728 ipv4.dns-search lab.example.com | ||
− | 4. configure DNS servers ( | + | 4. configure DNS servers ((use DNS servers appropriate for your internet provider, for your own internal network, or for your local data center - saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/ and in /etc/resolv.conf) |
# nmcli con mod eno16777728 ipv4.dns 172.100.170.90,172.100.130.90 | # nmcli con mod eno16777728 ipv4.dns 172.100.170.90,172.100.130.90 | ||
5. optional, list networking/connection info | 5. optional, list networking/connection info | ||
# nmcli con show eno16777728 | # nmcli con show eno16777728 | ||
− | |||
=== Network Setup (before ent 7) === | === Network Setup (before ent 7) === | ||
Line 31: | Line 30: | ||
NETMASK=255.255.255.0 | NETMASK=255.255.255.0 | ||
− | 1b. configure the default gateway and disable the dynamic link-local (DHCP network) address in /etc/sysconfig/network | + | 1b. configure the default gateway and disable the dynamic link-local (DHCP network) address in /etc/sysconfig/network<br> |
Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1" | Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1" | ||
GATEWAY=172.100.130.1 | GATEWAY=172.100.130.1 | ||
Line 44: | Line 43: | ||
2c. set the IP and hostname info in /etc/hosts (required for 'hostname -s' and other types of resolution) | 2c. set the IP and hostname info in /etc/hosts (required for 'hostname -s' and other types of resolution) | ||
− | 172.100.200.140 | + | 172.100.200.140 ks-c7a.lab.example.com ks-c7a |
− | 3. configure the DNS servers in /etc/resolv.conf ( | + | 3. configure the DNS servers in /etc/resolv.conf (use DNS servers appropriate for your internet provider, for your own internal network, or for your local data center) |
nameserver 172.100.170.90 | nameserver 172.100.170.90 | ||
nameserver 172.100.130.90 | nameserver 172.100.130.90 | ||
Line 55: | Line 54: | ||
Ent 6 | Ent 6 | ||
# ip addr | # ip addr | ||
− | |||
=== Changing the IP (ent 7) === | === Changing the IP (ent 7) === | ||
− | 1. set the new IP and netmask | + | 1. set the new IP and netmask<br> |
Note: if the IP is not getting set, please check or go through the Network Setup steps (above), specifically see the note on the default setting with DHCP/manual mode | Note: if the IP is not getting set, please check or go through the Network Setup steps (above), specifically see the note on the default setting with DHCP/manual mode | ||
# nmcli con mod eno16777728 ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1 | # nmcli con mod eno16777728 ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1 | ||
Line 65: | Line 63: | ||
# nmcli con mod eno16777728 ipv4.gateway 172.100.200.1 | # nmcli con mod eno16777728 ipv4.gateway 172.100.200.1 | ||
− | 2. restart networking | + | 2. restart networking<br> |
Note: this has worked remotely over ssh, as long as the two commands are entered together as per this example, otherwise doing the single down command will cause you to lose your connection and require console access to resolve/fix | Note: this has worked remotely over ssh, as long as the two commands are entered together as per this example, otherwise doing the single down command will cause you to lose your connection and require console access to resolve/fix | ||
# nmcli con down eno16777728 ; nmcli con up eno16777728 | # nmcli con down eno16777728 ; nmcli con up eno16777728 | ||
− | |||
=== Changing the IP (before ent 7) === | === Changing the IP (before ent 7) === | ||
− | 1. set the new IP and netmask in the ifcfg-interface file (usually ifcfg-eth0) under /etc/sysconfig/network-scripts/ | + | 1. set the new IP and netmask in the ifcfg-interface file (usually ifcfg-eth0) under /etc/sysconfig/network-scripts/<br> |
Note: ent 6 defaults to/prefers quotes around the params, i.e. NETMASK="255.255.255.0", ent 6 also introduced CIDR notation, ex; PREFIX="24" to replace the old/longer netmask convention (NETMASK="255.255.255.0") | Note: ent 6 defaults to/prefers quotes around the params, i.e. NETMASK="255.255.255.0", ent 6 also introduced CIDR notation, ex; PREFIX="24" to replace the old/longer netmask convention (NETMASK="255.255.255.0") | ||
IPADDR=172.200.110.140 | IPADDR=172.200.110.140 | ||
NETMASK=255.255.255.0 | NETMASK=255.255.255.0 | ||
− | 2. set the new default gateway in /etc/sysconfig/network | + | 2. set the new default gateway in /etc/sysconfig/network<br> |
Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1" | Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1" | ||
GATEWAY=172.100.130.1 | GATEWAY=172.100.130.1 | ||
Line 83: | Line 80: | ||
172.100.200.140 ks-c7a.lab.example.com ks-c7a | 172.100.200.140 ks-c7a.lab.example.com ks-c7a | ||
− | 4. restart networking | + | 4. restart networking<br> |
Note: recommended to use "&" when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected) | Note: recommended to use "&" when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected) | ||
# service network restart & | # service network restart & | ||
− | |||
=== Adding Additional IP's/Aliases (ent 7) === | === Adding Additional IP's/Aliases (ent 7) === | ||
Line 92: | Line 88: | ||
# nmcli con mod eno16777728 +ipv4.addresses 172.100.200.140/24 | # nmcli con mod eno16777728 +ipv4.addresses 172.100.200.140/24 | ||
− | 2. restart networking | + | 2. restart networking<br> |
− | Note: this has worked remotely over ssh, | + | Note: this has worked remotely over ssh, as long as the two commands are entered together as per this example, otherwise doing the single down command will cause you to lose your connection and require console access to resolve/fix |
# nmcli con down eno16777728 ; nmcli con up eno16777728 | # nmcli con down eno16777728 ; nmcli con up eno16777728 | ||
− | |||
=== Adding Additional IP's/Aliases (before ent 7) === | === Adding Additional IP's/Aliases (before ent 7) === | ||
Line 104: | Line 99: | ||
ONPARENT="yes" | ONPARENT="yes" | ||
− | 2. restart networking | + | 2. restart networking<br> |
Note: recommended to use & when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected) | Note: recommended to use & when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected) | ||
# service network restart & | # service network restart & | ||
− | |||
=== Adding Static Routes (ent 7) === | === Adding Static Routes (ent 7) === | ||
− | Set the address range and gateway address (saved in | + | Set the address range and gateway address (saved in a route-interface file in /etc/sysconfig/network-scripts/, in this example; route-eno16777728) |
# nmcli con mod eno16777728 ipv4.routes "172.200.210.0/24 172.200.210.120" | # nmcli con mod eno16777728 ipv4.routes "172.200.210.0/24 172.200.210.120" | ||
− | |||
=== Adding Static Routes (before ent 7) === | === Adding Static Routes (before ent 7) === | ||
Line 119: | Line 112: | ||
NETMASK0=255.255.255.0 | NETMASK0=255.255.255.0 | ||
GATEWAY0=172.200.210.120 | GATEWAY0=172.200.210.120 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Quick Reference === | === Quick Reference === | ||
Line 271: | Line 125: | ||
# cat /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-e* | # cat /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-e* | ||
− | Show IP Configuration (ent 7) | + | Show IP Configuration (ent 7)<br> |
Note: run 'nmcli dev' to find the device name | Note: run 'nmcli dev' to find the device name | ||
# nmcli dev | # nmcli dev | ||
Line 279: | Line 133: | ||
# nmcli con show ens32 | # nmcli con show ens32 | ||
− | Show Listening Ports (only) | + | Show Listening Ports (only)<br> |
Note: the : in the output normally denotes a listening port | Note: the : in the output normally denotes a listening port | ||
# lsof -nP | grep ":" | # lsof -nP | grep ":" |
Latest revision as of 11:37, 9 May 2017
Contents
- 1 Enterprise 7 Note
- 2 Network Setup (ent 7)
- 3 Network Setup (before ent 7)
- 4 Changing the IP (ent 7)
- 5 Changing the IP (before ent 7)
- 6 Adding Additional IP's/Aliases (ent 7)
- 7 Adding Additional IP's/Aliases (before ent 7)
- 8 Adding Static Routes (ent 7)
- 9 Adding Static Routes (before ent 7)
- 10 Quick Reference
Enterprise 7 Note
Networking drastically changed under Enterprise 7, which now has Network Manager fully integrated (which was recommended to be uninstalled in previous releases when used on a server/static configuration). On 7, the convention is now not to modify any config files (which may be auto-generated, and/or will get overwritten by updates), but to use command-line utilities to modify any of the configuration settings/parameters (which normally does not modify the primary config file, but creates an override config file usually in a separate location).
Network Setup (ent 7)
1. determine interface and connection name setup for the subsequent nmcli commands, use what it shows for the Connection name (Device and Connection name are normally the same, but not always the same - this needs to be checked to verify what to use).
Note: "show" is a default argument in most cases, and does not need to be specified, unless other "show" arguments/details are needed (as in: nmcli dev show eno16777728)
# nmcli dev
2. configure the interface, IP, and gateway (defaults to "automatic" (DHCP), change to "manual" to be able to configure static parameters - settings saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/, in this example; ifcfg-eno16777728)
# nmcli con mod eno16777728 ipv4.method manual ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1
3. configure hostname (saved in /etc/hostname) and domain (saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/ and in /etc/resolv.conf)
# nmcli gen hostname ks-c7a.lab.example.com # nmcli con mod eno16777728 ipv4.dns-search lab.example.com
4. configure DNS servers ((use DNS servers appropriate for your internet provider, for your own internal network, or for your local data center - saved in an ifcfg-interface file in /etc/sysconfig/network-scripts/ and in /etc/resolv.conf)
# nmcli con mod eno16777728 ipv4.dns 172.100.170.90,172.100.130.90
5. optional, list networking/connection info
# nmcli con show eno16777728
Network Setup (before ent 7)
most of this is common knowledge, but some of these additional steps have been added (moreso) as a comparison to the new ent 7 listing/steps (above)
1. configure the IP and gateway 1a. set the following in an ifcfg-interface file (usually ifcfg-eth0) under /etc/sysconfig/network-scripts/ Note: ent 6 defaults to/prefers quotes around the params, i.e. BOOTPROTO="none", ent 6 also introduced CIDR notation, ex; PREFIX="24" to replace the old/longer netmask convention (NETMASK="255.255.255.0")
BOOTPROTO=none IPADDR=172.200.110.140 NETMASK=255.255.255.0
1b. configure the default gateway and disable the dynamic link-local (DHCP network) address in /etc/sysconfig/network
Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1"
GATEWAY=172.100.130.1 NOZEROCONF=yes
2. configure hostname 2a. set the FQDN hostname in /etc/sysconfig/network
HOSTNAME=ks-c7a.lab.example.com
2b. set the domain in /etc/resolv.conf
domain lab.example.com
2c. set the IP and hostname info in /etc/hosts (required for 'hostname -s' and other types of resolution)
172.100.200.140 ks-c7a.lab.example.com ks-c7a
3. configure the DNS servers in /etc/resolv.conf (use DNS servers appropriate for your internet provider, for your own internal network, or for your local data center)
nameserver 172.100.170.90 nameserver 172.100.130.90
4. optional, list interface info
Ent 5 or older # ifconfig Ent 6 # ip addr
Changing the IP (ent 7)
1. set the new IP and netmask
Note: if the IP is not getting set, please check or go through the Network Setup steps (above), specifically see the note on the default setting with DHCP/manual mode
# nmcli con mod eno16777728 ipv4.addresses 172.100.200.140/24 ipv4.gateway 172.100.200.1 OR # nmcli con mod eno16777728 ipv4.addresses 172.100.200.140/24 # nmcli con mod eno16777728 ipv4.gateway 172.100.200.1
2. restart networking
Note: this has worked remotely over ssh, as long as the two commands are entered together as per this example, otherwise doing the single down command will cause you to lose your connection and require console access to resolve/fix
# nmcli con down eno16777728 ; nmcli con up eno16777728
Changing the IP (before ent 7)
1. set the new IP and netmask in the ifcfg-interface file (usually ifcfg-eth0) under /etc/sysconfig/network-scripts/
Note: ent 6 defaults to/prefers quotes around the params, i.e. NETMASK="255.255.255.0", ent 6 also introduced CIDR notation, ex; PREFIX="24" to replace the old/longer netmask convention (NETMASK="255.255.255.0")
IPADDR=172.200.110.140 NETMASK=255.255.255.0
2. set the new default gateway in /etc/sysconfig/network
Note: ent 6 defaults to/prefers quotes around the params, i.e. GATEWAY="172.100.130.1"
GATEWAY=172.100.130.1
3. set the IP info in /etc/hosts (required for 'hostname -s' and other types of resolution)
172.100.200.140 ks-c7a.lab.example.com ks-c7a
4. restart networking
Note: recommended to use "&" when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected)
# service network restart &
Adding Additional IP's/Aliases (ent 7)
1. add the additional IP
# nmcli con mod eno16777728 +ipv4.addresses 172.100.200.140/24
2. restart networking
Note: this has worked remotely over ssh, as long as the two commands are entered together as per this example, otherwise doing the single down command will cause you to lose your connection and require console access to resolve/fix
# nmcli con down eno16777728 ; nmcli con up eno16777728
Adding Additional IP's/Aliases (before ent 7)
1. create an ifcfg-interface:aliasnumber file in /etc/sysconfig/network-scripts/ (ifcfg-eth0:0 for this example), with the following contents
DEVICE="eth0:0" IPADDR="172.100.200.140" NETMASK="255.255.255.0" ONPARENT="yes"
2. restart networking
Note: recommended to use & when connected remotely so the command will continue after the network gets disconnected (your session is normally not lost in this case, and you would normally stay connected)
# service network restart &
Adding Static Routes (ent 7)
Set the address range and gateway address (saved in a route-interface file in /etc/sysconfig/network-scripts/, in this example; route-eno16777728)
# nmcli con mod eno16777728 ipv4.routes "172.200.210.0/24 172.200.210.120"
Adding Static Routes (before ent 7)
Create a route-interface file (for IPv4), example /etc/sysconfig/network-scripts/route-eth0 (or route-bond0 for a bonding interface);
ADDRESS0=172.200.210.0 NETMASK0=255.255.255.0 GATEWAY0=172.200.210.120
Quick Reference
past what is shown above, here are a few additional/helpful commands
Show IP Info (before ent 6)
# ifconfig
Show IP Info (ent 6 and newer)
# ip addr
Show IP Configuration (before ent 7)
# cat /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-e*
Show IP Configuration (ent 7)
Note: run 'nmcli dev' to find the device name
# nmcli dev DEVICE TYPE STATE CONNECTION ens32 ethernet connected ens32 lo loopback unmanaged -- # nmcli con show ens32
Show Listening Ports (only)
Note: the : in the output normally denotes a listening port
# lsof -nP | grep ":"
Show Network Connections (before ent 7)
# netstat -an
Show Network Connections (ent 7)
# ss -an