This network configuration guide is based on Fedora.
Configuration Tools
Text console configuration tool:
- /usr/sbin/system-config-network-tui
- /sbin/ifconfig
Using ifconfig:
- ifconfig – display running network configuration
- ifconfig -a – display all (running or not running network device) network configuration
- ifconfig <interface> up – bring up the specified interface network
- ifconfig <interface> down – bring down the specified interface network
- ifconfig eth0 192.168.1.188 netmask 255.255.255.0 – setup a network interface with a specific IP address and sub-net mask
- For further usage check #man ifconfig
Network Configuration Files
/etc/sysconfig/network – Defines your network and some of its characteristics.
The settings are:
- NETWORKING=yes
- HOSTNAME=localhost.localdomain
/etc/sysconfig/network-scripts/ifcfg-eth* – This is a configuration file for each network interface card. For eth0 the path would be /etc/sysconfig/network-scripts/ifcfg-eth0
The settings are permanent; some of the entries are shown below:
- DEVICE=eth0
- HWADDR=00:03:10:22:45
- #For permanent fixed IP address
- IPADDR=192.168.1.100
- NETMASK=255.255.0.0
- ONBOOT=yes
- BOOTPROTO=none
/etc/networks - Provides a database of network names with network addresses similar to the /etc/hosts file.
The settings are:
- Default 0.0.0.0
- Loopback 127.0.0.1
- Link-local 169.254.0.0
/etc/hosts – Defines local hosts.
The settings are:
- 127.0.0.1 localhost localhost.localdomain
- 192.168.1.100 mymachine.mycompany.com mymachine
/etc/host.conf – Specifies order to search for host name for name resolution.
The settings are:
- Multi on
- Order hosts, bind
/etc/resolv.conf - Contains the address of name server
The settings are:
- Nameserver your.isp.name.server
Configuring Ethernet Manually
Fixed IP
- Ifconfig to set IP address and bring up the network card
#ifconfig eth0 192.168.1.188 netmask 255.255.255.0 up
- To setup the network routing
#route add -net 192.168.0.0 netmask 255.255.255.0 eth0
- Use route add or ip to add default gateway
#route add default gw 192.168.1.1 eth0
Add “nameserver 218.186.1.88” at /etc/resolve.conf
- Note: Please note that the above measure is temporary. To permanently set ip address, gateway and dns use system-config-network-tui.
- Once you set fixed IP, netmask, gateway and DNS. The information will be recorded in etc/sysconfig/network-scripts/ifcfg-eth* as follows;
- DEVICE=eth0
- HWADDR=00:05:20:15:36
- #For permanent fixed IP address
- IPADDR=192.168.1.100
- NETMASK=255.255.0.0
- ONBOOT=no
- BOOTPROTO=none
- Note: If you have hard coded fixed IP in the config file ifcfg-eth*, if you type #ifconfig eth0 up, it will not configure the fix IP from the file, the eth0 is up with no address assigned.
- Therefore, a proper way to completely bring up and down the network interface card (NIC) is to use #ifup and #ifdown instead of ifconfig.
- If eth0 is down for some reason, using #ifup eth0 will turn on the NIC with all address, gatway and DNS configure in the file
- The console utility (system-config-network-tui) do not have the ability to set the configuration such that eth0 is turn on during startup, to do this we must manually change to ONBOOT=yes.
- If eth0 still will not turn on during startup; this is because the service network is not turn on.
- To turn on the network service during startup, use the command #service network start
- To permently turn on the network service #chkconfig network on
DHCP Client
- If inside the file ifcfg-eth0,the entry ‘BOOTPROTO = none’ or there is no entry on BOOTPROTO use the following:
- If inside the file ifcfg-eth0, the entry ‘BOOTPROTO = dhcp’ use the following:
- Note: To configure BOOTPROTO just run the utilities system-config-network-tui
- However, the console utility do not have the ability to set the configuration such that eth0 is turn on during startup, to do this we must manually change the file etc/sysconfig/network-scripts/ifcfg-eth*; ONBOOT=yes
- Then make sure service Network is started and set to turn on permanently with the command #chkconfig network on
Alternative method of starting network
- Add the following at /etc/rc.d/rc.local
- or
- Note: Using local startup script, there is no need to turn on network services
Network Manager (New)
- A new way of managing network is to install the package NetworkManager which does the management of network automatically.
- NetworkManager is designed to replace all other network configuration. It includes all types of network from Ethernet to wireless network.
- Use the command #yum install NetworkManager
- Using NetworkManager, you still need tp ensure that the settings for eth* is setup properply. You need to ensure that ONBOOT=yes.
End.