LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
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?

Notices

Reply
 
Search this Thread
Old 07-31-2005, 03:31 PM   #1
jclu
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 192.168.xxx.100-199. 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 192.168.xxx.104
# netmask 255.255.255.0

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
Hiran
 
Old 07-31-2005, 04:06 PM   #2
cdhgee
Member
 
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:

Code:
[david@malvern ~]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
fat-rk-69.t6-ln *               255.255.255.255 UH    0      0        0 ppp0
10.255.254.0    *               255.255.255.0   U     0      0        0 eth0
169.254.0.0     *               255.255.0.0     U     0      0        0 eth0
default         fat-rk-69.t6-ln 0.0.0.0         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 192.168.0.1).

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

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

Code:
route add default gw 192.168.0.1
 
Old 07-31-2005, 05:35 PM   #3
maroonbaboon
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

gateway 192.168.1.254

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.
 
  


Reply


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


All times are GMT -5. The time now is 02:37 PM.

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