Linux Network

From EWIKI
Jump to navigation Jump to search

Linux Network Command Replacement

Command Purpose Deprecated
ip n show neighbors arp
ip a show interfaces ifconfig
ip r show routes route
ss network status nestat

Network Configuration Files

Ubuntu/Debian

/etc/network/interfaces

auto lo
iface lo inet loopback

or

auto eth0
iface eth0 inet static
address 192.168.2.123
netmask 255.255.255.0
gateway 192.168.2.1

To change IPs:

sudo /etc/init.d/networking restart

Remove old IP:

sudo ip a del 192.168.2.xxx dev eth0

RHEL/CentOS/Fedora

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=192.168.2.123
NAME="System eth0"
HWADDR=00:xx:xx:xx:xx:xx
GATEWAY=192.168.2.1