Configure Network Card via Command Line

Although Linux machines are reliable and stable but unfortunatly even the best computers go down or crash. When it does having a network card up and running is almost a must, to both back up any data and to help in reinstalling if need be. Below are the steps to follow.

from a console type dmesg | grep eth and look for something along the lines of:


eth0: D-Link DFE-538TX (RealTek RTL8139) board found at 0xd8017000, IRQ 11


Your system may not have a D-Link like the output from this test machine, but if you get any output back from the previous command then theres a good chance a network card has been detected by the linux system.


Now to configure the NIC you need to know several things:


IP address: one that reflects your network and not in use by another computer
Broadcast address: to match the ip address selected above
Netmask again this has to match your network settings
Gateway: maybe this is not necessary, but if you are using a router it will be the routers IP address
DNS servers: this can be obtained by your internet service provider


For my example I will be configuring a NIC eth0 with an ipadress 10.200.10.20 a broadcast of 10.200.10.255 a netmask of 255.255.255.0 a gateway of 10.200.10.200 and a dns server 1.2.3.4


type into a console ifconfig eth0 10.200.10.20 broadcast 10.200.10.255 netmast 255.255.255.0


/sbin/route add -net default gw 10.200.10.200 netmask 0.0.0.0 metric 1


Finally to setup DNS resolving of domain names create or edit the file /etc/resolv.conf and on the first line of the file enter 1.2.3.4


You should now have a fully operational networked system, do a ping test ping yahoo.com to another computer on your network and see if you get a reply, or if you have internet see if you can ping a website. If you get errors make sure and double check your network settings. If you have any concerns of what settings you have chosen ask you administrator; or email me and I will do my best to help.