header01
header02 Products Services Support Contact
header01

Network settings

How to determine the IP address

To see the existing IP address, open a terminal window and type:

$ /sbin/ifconfig

This will display the configurations for all network interfaces. Look for the line that says 'inet addr:xxx.xxx.xxx.xxx' for the interface you're interested in. The xxx's here will be the system's primary IP address.


How to use a static IP address

You can use a static IP address in two ways:

  • edit the interface configuration file

    Network interface files are usually located in /etc/sysconfig/network-scripts/. Look for a file called 'ifcfg-yyy#' where yyy will be the interface name and # will be it's number (for example, for an ethernet connection the filename may be ifcfg-eth0). Each line in this file is a key=value pair. Edit the key value 'BOOTPROTO' and change it to 'none'. Also edit the key value 'IPADDR' to change the IP address for this interface. After making a change, you'll need to restart networking (see below).

  • use the network config GUI

    Point to Applications->System Settings->Network and provide the root password if prompted. Click the Devices tab, and highlight the network interface from the list and click Edit. Make sure the option 'Statically set IP addresses' is selected, and provide the IP address, Netmask and Gateway addresses. Click OK and then File->Save in the Network Configuration dialog box. You'll need to restart networking for the changes to take effect. Make sure the network interface you just edited is still highlighted, then click Deactivate. After it deactivates, click Activate. Check the IP address with /sbin/ifconfig (see above).


How to use a dynamic IP address

You can use a dynamic IP address in two ways:

  • edit the interface configuration file

    Find the network interface configuration file (see above), and change the key value 'BOOTPROTO' to 'dhcp'. Restart networking.

  • use the network config GUI

    Same as static IP instructions above, but make sure the option 'Automatically obtain IP address settings with' is selected, and choose 'dhcp' from the pull-down list. If you know the hostname of your dhcp server, provide it. Click OK and then File->Save in the Network Configuration dialog box. You'll need to restart networking for the changes to take effect. See 'static IP' instructions above.


How to change nameservers

You can edit nameservers in two ways:

  • edit the resolve configuration file

    Usually located in /etc/resolv.conf, this file will list each DNS server on a line (for example, nameserver 192.168.0.100). You can edit them directly and put in as many as you want. Changes take effect immediately, there's no need to restart networking.

  • use the network config GUI

    Open the Network Configuration dialog box as with the static IP instructions above and choose the DNS tab. The GUI provides up to 3 DNS servers as well as a DNS search path.


How to change the gateway

Editing the gateway can be done when assigning a system's static IP address:

  • edit the resolve configuration file

    Edit the network interface configuration file as instructed above for a static IP address and change the 'GATEWAY' key value to the IP address of the network gateway. You need to restart networking for the changes to take effect.

  • use the network config GUI

    Open the Network Configuration dialog box as instructed above for a static IP address. Provide the network gateway in the 'Default gateway address' box. You need to restart networking for the changes to take effect.


How to restart networking from the command line
In a terminal window, type (as root):
$ /etc/rc.d/init.d/network restart
Or, you can type (again, as root):
$ service network restart
If there's an error, you can consult /var/log/messages for more information.

Linux News courtesy of /.

What's the Damage? Measuring fsck Under XFS and Ext4 On Big Storage
2012-02-03

Linux Game Publishing CEO Resigns
2012-02-01

Greg KH Leaves SUSE For Linux Foundation
2012-02-01

Why Linux Vendors Need To Sell More Than Linux
2012-01-31

New Spark Tablet To Come Loaded With KDE's Active Plasma Interface
2012-01-29

Exploits Emerge For Linux Privilege Escalation Flaw
2012-01-25

KDE 4.8 Released
2012-01-25