Networking

This section discusses connecting a Linux system to a network and/or the Internet.


Configuring the network settings the easy way

Configuring your network is very easy with Red Hat Linux and much of it (if not all of it) is done when you install Linux.

You can change the network configuration by clicking on the Red Hat in the bottom left corner of your screen, then System Settings-->Network. You will be guided through the steps to configuring your network. The process id described here and an example is shown next:

linux network configuration

Setting your hostname, IP address, netmask, gateway, DNS server via files

It is sometimes helpful to know what is going on behind the scenes or if you want to modify the network configuration via changing files.

For example, assume you want to modify the network configuration by modifying files with the following:

Networking is set up in 4 files: First, add your host to the /etc/hosts file:
# The next line "127.0.0.1" is needed. Do not remove it.
127.0.0.1       localhost.localdomain localhost
192.168.12.21   summer
Your /etc/sysconfig/network file would be:
NETWORKING=yes
HOSTNAME=summer
GATEWAY=192.168.12.254
Your /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.12.255
IPADDR=192.168.12.21
NETMASK=255.255.255.0
NETWORK=192.168.12.0
ONBOOT=yes
DNS servers are set in: /etc/resolv.conf. An example:
domain acme.com
search acme.com
nameserver 192.168.12.21
nameserver 192.168.12.23

Using ifconfig and route

You normally would not need to use ifconfig or route unless you want to change your IP address, disable the Ethernet interface, etc. change your gateway, etc. This is sometimes helpful, so the information is here. To set an ip address:
ifconfig eth0 192.168.12.56 netmask 255.255.255.0 up

To set a default route or gateway ("gw" = "gateway"):

route add default gw 192.168.12.1 eth0

Troubleshooting

If your system is saying there is no Ethernet card found, make sure the card is in the kernel.

Type:

modprobe eth0

dmesg | less
    Look for any info about eth0 to help track down the problem.
    

cat /etc/modules.conf
    Look for a line line this:
    alias eth0 driver-name-like-wdi or 3c503
    


Where to get more information

  • Red Hat Network Configuration
  • Ethernet HOWTO

    Linux Quick Reference Home