Assuming that you're dealing with the simple situation of having a host with a single network card, here's the bare minimum you should know to get your system onto the network as quickly as possible. (More advanced network configuration will be covered later.)
As long as you're dealing with a typical TCP/IP network card, its device name is almost certainly going to be eth0. You have two choices for configuring and activating your network interface:
If you want to statically configure the card, be prepared to supply some combination of its IP address, subnet mask, default gateway and at least one DNS name server address.
The other option is to register as a DHCP client, and get all that information from the DHCP server. (This, of course, requires setting up the DHCP server, but for now, we're assuming that's not your problem.)
To configure the interface, run the following command-line utility and just fill in the blanks:
# netconfig # service network restart just to play it safe
Once the card is configured, you can examine and activate and deactivate it with:
# ifconfig examine all networking configuration # ifconfig eth0 examine just eth0 # ifdown eth0 deactivate that interface # ifup eth0 activate that interface # route display the routing table # ping www.linux-migration.org test the interface # service network restart restart all TCP/IP networking
If you expect to deactivate your interface from time to time, you should make a note of two different ways to call ifconfig to examine your interfaces:
# ifconfig display only active interfaces # ifconfig -a diaplay all interfaces, active or not
Tip | |
---|---|
While network configuration is typically done by the superuser, even regular users have the right to run ifconfig, as long as they're only using it to display interface information, and not trying to change any of it. Since the ifconfig command is most likely in the /sbin directory, a regular user can either run the fully-qualified command /sbin/ifconfig, or can add that directory to his search path so that he need only type ifconfig from now on. This can be a real time-saver. |