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 a broadcast of a netmask of a gateway of and a dns server

type into a console ifconfig eth0 broadcast netmast

/sbin/route add -net default gw netmask 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

You should now have a fully operational networked system, do a ping test ping 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.