Redhat: Network Config commands

From Define Wiki
Jump to navigation Jump to search

ifup / ifdown

The simplest commands for network configuration simply activate and deactivate and network adapter

ifup eth0
ifup ifcfg-eth0

ifdown eth0
ifdown ifcfg-eth0

ifconfig

The ifconfig command allows much more control over the network settings. In its simplest use it lists all currently active network adapters. Adding the '-a' flag will list all available adapters.

If you want to see the details of the specific adapter this can be passed to ifconfig. To see only the configuartion of eth0 run 'ifconfig eth0'

[root@head ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:25:90:00:82:E0
          inet addr:172.16.1.1  Bcast:172.16.255.255  Mask:255.255.0.0
          inet6 addr: fe80::225:90ff:fe00:82e0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4088409922 errors:26 dropped:0 overruns:208 frame:9
          TX packets:486861758 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5941475288814 (5.4 TiB)  TX bytes:133096527832 (123.9 GiB)
          Memory:fbce0000-fbd00000

Configuration using ifconfig

The ifconfig command gives much more control over the network connections. The command can be used to change a wise variety of options by passsing the correct flag.

As an example to change the ip address of eth1 to 172.28.0.5 you could run:

ifconfig eth1 172.28.0.5

There are too many options to show examples of here, but the options available are shown in the table:

up activate adapter
down deactivate adapter
netmask <address> sete netmask to adress
broadcast <address> set broadcast to adress
metric <N> set the metric value to N for the routing table
MTU <N> set the maximum transmission unit to N
-arp deactivate address resolution protocol
promisc activate promiscuous mode
-promosc deactivate promiscuous mode