Setting up the network interface in CentOS 6.3
So you have a fresh installation of CentOS and you badly want to assign an IP address so you could download and install new apps. This is how you can do it. First, issue ifconfig command and see what network interfaces are up.
As you can see in the screenshot, there’s only one interface and it is a loopback interface. Ethernet interface is missing. To turn it on enter ifup eth0 command. To turn it off again use ifdown eth0. Now issue ifconfig and you will see eth0 in the output.
Now go to /etc/sysconfig/network-scripts. The file where you can configure the main network interface is called ifcfg-eth0. Use nano ifcfg-eth0 command to edit the parameters.
Static IP address configuration:
ONBOOT="yes" // Change it from NO to YES so next time the interface would go up automatically
To set up the gateway go to /etc/sysconfig and open the file called network. Change it appropriately:
To set up DNS proceed to /etc and open the file resolv.conf and insert your preferred DNS servers:
If you need to get the IP address automatically from a DHCP server get back to /etc/sysconfig/network-scripts and make the following changes in ifcfg-eth0:
Setting up the network interface in FreeBSD using DHCP
Temporary solution until the system is restarted:
# ifconfig //used to find out the interface name
DHCPREQUEST on em0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.11 -- renewal in 21600 seconds.
# cd etc/
# ee rc.conf