How to configure a network interface in Linux
Linux provides “ifconfig” command to configure network interfaces.
To display list of available interfaces:
[root@techpulp ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:65:23:5E:D4:3C inet addr:192.168.191.1 Bcast:192.168.191.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:261958 errors:0 dropped:0 overruns:0 frame:0 TX packets:201967 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:322195982 (307.2 MiB) TX bytes:18627969 (17.7 MiB) Interrupt:21 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:4 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:240 (240.0 b) TX bytes:240 (240.0 b) [root@techpulp ~]#
To bring down an interface “eth0″:
[root@techpulp ~]# ifconfig eth0 down
To bring up an interface “eth0″:
[root@techpulp ~]# ifconfig eth0 up
To configure an interface with an IP address:
[root@techpulp ~]# ifconfig eth0 192.168.191.1 netmask 255.255.255.0 up
(or)
[root@techpulp ~]# ifconfig eth0 192.168.191.1/24 up

