Isle of Wight computer help

Home |  Contact |  Case studies |  Computer help |  Links |  Feedback |  Sitemap | 

Setting up a single Mandrake/Mandriva Linux PC with static ethernet IP address.
Assumes you have a simple network, you have run Mandrake's Internet wizard and still cannot connect to the Internet.

For the following environments:
This_PC-->hub/switch-->another PC running (working) internet connection sharing

Not suitable for a computer that shares its connection (but may help you understand some of the files/concepts) - see Internet connection sharing or Internet connection sharing with a dial-up modem for these scenarios.

First check your cabling - can Windows connect if you have a dual boot machine? Do they work on a known good network?

For our purposes:
Network interface cards (NICs) are called eth0, eth1 etc in Linux
IP ADDRESS is a number used to uniquely identify a network interface
DEFAULT GATEWAY address is the IP address of the device connected to the internet eg. your router, or PC running internet connection sharing (ICS). The address to use is the one allocated to the interface connected to your internal network. It will almost certainly be in one of the ranges in "Note about IP addresses" below. Most likely , or
NAMESERVER address is the IP address of your internet service providers (ISP) nameserver - used to look up the corresponding IP address of a human readable address like
HOSTNAME is a unique name for your computer - anything you like, for example linux.mylan.home or zeus.greekgods or kevin but not,

Note about IP addresses:
Each interface on your network must have a different IP address. The usual numbering schemes for private networks are 192.168.x.x or 10.x.x.x
The numbering scheme used should match that of your gateway device (router, PC running internet connection sharing (ICS),cable modem etc) if you have one. For example, if your router manual says the IP address is you will number your computer network interfaces, etc.
You need to find out what your IP address and default gateway are - these can be obtained from a working windows installation if you dual boot, or your router/cable modem manual as above. You will also need your nameserver IP address (get it from your ISP)

You will need to be root (administrator) to edit the files here.
To sign on as root - type su in a terminal (console), press enter followed by your root password

Edit  /etc/sysconfig/network-scripts/ifcfg-eth0 - This is the main config file for the interface.
It should read : (you can leave out anything on a line after #)
IPADDR=         # or whatever your IP address is to be - see above
NETMASK=      # or if your IP address is 10.x.x.x
NETWORK=        # or if your IP address is 10.x.x.x or if your IP address is 192.168.2.x
BROADCAST=    # or if your IP address is 10.x.x.x or if your IP address is 192.168.2.x

/etc/resolv.conf should contain the nameserver address(es) - put the address of your ISPs nameserver right at the top. eg:
If you are using a router that provides DNS lookup forwarding (many do - check the manual) you can put the IP address of that in here e.g. . If unsure, use the ISP's DNS address.

The default gateway and your hostname go in /etc/sysconfig/network:
GATEWAY=    # or the IP address of your gateway device - your default gateway

In a terminal, type:
iptables -t nat -D PREROUTING -i eth0 -j loc_dnat

You may get an error with this - don't worry - if you do, just skip the next line:
Add the above code to the bottom of /etc/rc.d/rc.local.
This will bypass a proxy server Mdk will have set up if you ran the ICS wizard.

Then type ifup eth0 - this should bring up the network

Then try it all out:
Try pinging your computers NIC (type "ping" or whatever your IP address is) If you get errors, then your NIC is not working - ask for help (see below).
If OK - Try pinging the gateway
If OK - Try browsing - if you cannot reach say,, try typing (IP address of google) into your browser address bar.
(If you cannot reach a site by name, but can get it by IP address, you have a name resolver (DNS) problem.
Check to make sure it all works across a reboot.

Once working, you should set up a firewall - see click on the 'standalone Linux system' link there.

If you are still having problems, post the following information in the networking forum:
Overview of your problem - not just "I can't connect to the internet" - what have you done/tried so far, what works, what doesn't?
Physical network set up - what plugs in to what
Output of "ifconfig" , "route -n" , "iptables -nvL" and "iptables -nvL -t nat"
Results of all pings above.

Please pass on your comments to me - consider this work in progress.

If you live on the Isle of Wight (UK) and you are still stuck, give me a call!
For other mandrake Linux problems, try