Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 07-31-2005, 03:31 PM   #1
LQ Newbie
Registered: May 2005
Posts: 9

Rep: Reputation: 0
Using static ips with a router

I'm having trouble setting my Debian box to use a static ip. My dad has a US Robotics wireless router with DHCP enabled for the ip range Now we have 2 wireless connections and about 4-5 ethernet connections that are set up to use DHCP (including my Debian box). Apart from my machine, all the other computers use Windows.

Now when I tried to set /etc/network/interfaces to use a static ip for eth0, ifconfig reports the correct ip, but I can't get internet access (although I can ping the router using the gateway ip).

Here is /etc/network/interfaces:
# The primary network interface
auto eth0
iface eth0 inet dhcp
#iface eth0 inet static
# address
# netmask

As I said, if I comment out the dhcp line, and uncomment the static lines, and then run 'ifdown eth0' and 'ifup eth0' or restart, ifconfig reports the correct ip and subnet, but I can't ping anything outside the lan or access any websites.

What should I do? I want to forward some ports to my comp, and it's easier to do if my comp has a static ip. Thanks for any help.

God bless
Old 07-31-2005, 04:06 PM   #2
Registered: Oct 2003
Location: St Paul, MN
Distribution: Fedora 8, Fedora 9
Posts: 513

Rep: Reputation: 30
Have you updated the routing table to set the default route to go through the wireless router? If you run the command 'route' it will show you the current routing table - the default route needs to be the gateway. E.g. my box is configured like this:

[david@malvern ~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
fat-rk-69.t6-ln *      UH    0      0        0 ppp0    *        U     0      0        0 eth0     *          U     0      0        0 eth0
default         fat-rk-69.t6-ln         UG    0      0        0 ppp0
This tells the kernel to send all packets that don't match any of the first three rules the 'default' entry at the bottom (which is actually a DNS name but it's got truncated). It sounds like you need to configure your box to do the same. To change the default route, use the route command as follows (assuming your router's IP is

Firstly, if you already have a default route in the routing table, run this:

route del default
Then run this to add the new default route:

route add default gw
Old 07-31-2005, 05:35 PM   #3
Senior Member
Registered: Aug 2003
Location: Sydney
Distribution: debian
Posts: 1,495

Rep: Reputation: 48
Yes the above post looks like the right diagnosis. In Debian you just need the line


in that /etc/network/interfaces files (change the address to suit your router).

As well as the iface, address and netmask lines, of course.

Last edited by maroonbaboon; 07-31-2005 at 05:38 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
internet router for multiple static ips shizzilla Linux - Networking 3 11-23-2005 11:20 PM
shorewall with 2 external static ips and DMZ gjmwalsh Linux - Networking 0 05-10-2004 09:31 PM
ADSL - Routing Static IPs NiM Linux - Networking 1 03-06-2004 06:57 AM
ifconfig/netconfig in Redhat 9 (static IPs) GomiCowboy Linux - Networking 6 09-07-2003 01:11 PM
Adding multiple static IPs to one NIC digihlp Linux - Networking 2 06-26-2003 07:13 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration