Linux Training

Linux training for private, public & voluntary sector.

0800 024 8425

City LinUX Training Courses

Section 17.

Network
configuration
.


"The Network is the Computer."

John Gage - Sun Microsystems 1984.

17. Network configuration.

The command /sbin/ifconfig -a can be used to report on the network interface configuration and some basic statistics on the traffic through each interface.

17.1. Examples

bash-4.2# ifconfig -a
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.4  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::207:e9ff:feb0:d042  prefixlen 64  scopeid 0x20<link>
        ether 00:07:e9:b0:d0:42  txqueuelen 1000  (Ethernet)
        RX packets 440521  bytes 231020833 (220.3 MiB)
        RX errors 0  dropped 377  overruns 0  frame 0
        TX packets 422575  bytes 139951096 (133.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 216261  bytes 68171872 (65.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 216261  bytes 68171872 (65.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

With root privileges ifconfig can be used to set a number of parameters including the ip address, network mask, and broadcast address. The interface can also be activated and deactivated.

17.2. Examples.

bash-4.2# ifconfig|grep eth
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:07:e9:b0:d0:42  txqueuelen 1000  (Ethernet)

bash-4.2# ifconfig eth1
eth1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        inet 10.0.0.14  netmask 255.255.255.0  broadcast 10.0.0.255
        ether 00:07:e9:b0:d0:42  txqueuelen 1000  (Ethernet)
        RX packets 444377  bytes 233019619 (222.2 MiB)
        RX errors 0  dropped 377  overruns 0  frame 0
        TX packets 426914  bytes 140687564 (134.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sa101$ ifconfig eth1 10.0.0.4 netmask 255.255.255.0 broadcast 10.0.0.255 up
sa101$ ifconfig
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.4  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::207:e9ff:feb0:d042  prefixlen 64  scopeid 0x20<link>
        ether 00:07:e9:b0:d0:42  txqueuelen 1000  (Ethernet)
        RX packets 444442  bytes 233024071 (222.2 MiB)
        RX errors 0  dropped 377  overruns 0  frame 0
        TX packets 426964  bytes 140696016 (134.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 221358  bytes 70381542 (67.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 221358  bytes 70381542 (67.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sa101$ ifconfig eth1 down
sa101$ ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 221376  bytes 70383294 (67.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 221376  bytes 70383294 (67.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
sa101$ ifconfig eth1 up

sa101$ ifconfig eth1
eth1: flags=4098<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 10.0.0.4  netmask 255.255.255.0  broadcast 10.0.0.255
        ether 00:07:e9:b0:d0:42  txqueuelen 1000  (Ethernet)
        RX packets 444451  bytes 233024695 (222.2 MiB)
        RX errors 0  dropped 377  overruns 0  frame 0
        TX packets 426970  bytes 140697228 (134.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

















































































































































































































































The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.