Networking Forums

Networking Forums > Computer Networking > Linux Networking > Tell me about static IP routing

Reply
Thread Tools Display Modes

Tell me about static IP routing

 
 
sz
Guest
Posts: n/a

 
      04-11-2004, 01:14 AM
I'm trying to put together a small home LAN with a file server using
SuSE 9.0. Right now I have 3 PCs behind an SMC barricade router with
DHCP enabled. But with the server, I'd like to use static IPs to keep
things simpler. I've changed /etc/sysconfig/network/ifcfg-eth0 on my
main client box to look like

DEVICE='eth0'
BOOTPROTO='static'
STARTMODE='onboot'
IPADDR="192.168.2.111"
NETMASK="255.255.255.0"
GATEWAY='192.168.2.1'

where 192.168.2.1 is the router's gateway address. Where I run into
trouble is when I try to add static routing either through the routing
table in /etc/sysconfig/network/routes or from the command line. I've
tried a bunch of things and won't list all of them here, just that
entering "route add default gw 192.168.2.1" from the command line
doesn't work. I can still ping all the machines on the LAN and the
gateway, but I can't get outside the router. How do I set up static
routing so this will all work?
 
Reply With Quote
 
 
 
 
Leo (Bing) Whiteway
Guest
Posts: n/a

 
      04-11-2004, 03:26 AM
sz wrote:
> I'm trying to put together a small home LAN with a file server using
> SuSE 9.0. Right now I have 3 PCs behind an SMC barricade router with
> DHCP enabled. But with the server, I'd like to use static IPs to keep
> things simpler. I've changed /etc/sysconfig/network/ifcfg-eth0 on my
> main client box to look like
>
> DEVICE='eth0'
> BOOTPROTO='static'
> STARTMODE='onboot'
> IPADDR="192.168.2.111"
> NETMASK="255.255.255.0"
> GATEWAY='192.168.2.1'
>
> where 192.168.2.1 is the router's gateway address. Where I run into
> trouble is when I try to add static routing either through the routing
> table in /etc/sysconfig/network/routes or from the command line. I've
> tried a bunch of things and won't list all of them here, just that
> entering "route add default gw 192.168.2.1" from the command line
> doesn't work. I can still ping all the machines on the LAN and the
> gateway, but I can't get outside the router. How do I set up static
> routing so this will all work?

Hi; I am not sure of this but I have the same router and I find that I have to
assign fixed ip addresses in the area of 192.168.2.2 to 99. I think the
addresses of 192.168.2.100 to 199 are reserved for dynamic dhcp.
I could be wrong but it may be something to look at.


--
Leo (Bing) Whiteway in Kelowna, BC, Canada: Ham calls: VE7UW and VE7OKV
A computer without Microsoft is like a chocolate cake without mustard.
Everyone should have a chance to try Linux. It's great.
http://www.bclinux.ca/ < running Slackware 9.1 >
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      04-11-2004, 04:59 AM
On 10 Apr 2004 18:14:30 -0700, sz <(E-Mail Removed)> wrote:
> I'm trying to put together a small home LAN with a file server using
> SuSE 9.0. Right now I have 3 PCs behind an SMC barricade router with
> DHCP enabled. But with the server, I'd like to use static IPs to keep
> things simpler. I've changed /etc/sysconfig/network/ifcfg-eth0 on my
> main client box to look like
>
> DEVICE='eth0'
> BOOTPROTO='static'
> STARTMODE='onboot'
> IPADDR="192.168.2.111"
> NETMASK="255.255.255.0"
> GATEWAY='192.168.2.1'
>
> where 192.168.2.1 is the router's gateway address. Where I run into
> trouble is when I try to add static routing either through the routing
> table in /etc/sysconfig/network/routes or from the command line. I've
> tried a bunch of things and won't list all of them here, just that
> entering "route add default gw 192.168.2.1" from the command line
> doesn't work. I can still ping all the machines on the LAN and the
> gateway, but I can't get outside the router. How do I set up static
> routing so this will all work?


Doesn't the GATEWAY='192.168.2.1' automatically set the gateway? Maybe
you cannot set it because it is already there (check 'route -n').

Make sure that the static IP you use is in same network, but _outside_ of
the DHCP assigned range of router.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
sz
Guest
Posts: n/a

 
      04-11-2004, 03:30 PM
Yes, the IP I've assigned is below the range 192.168.2.100 to 199.
I've changed it to 192.168.2.11 like Leo suggested but that hasn't
worked either. I've also tried a few different methods (actually a
couple dozen by now) and at least one them involved not specifying a
route with 'route' or /etc/sysconfig/network/routes at all. No luck
there either.
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      04-12-2004, 06:32 AM
On 11 Apr 2004 08:30:00 -0700, sz <(E-Mail Removed)> wrote:
> Yes, the IP I've assigned is below the range 192.168.2.100 to 199.
> I've changed it to 192.168.2.11 like Leo suggested but that hasn't
> worked either. I've also tried a few different methods (actually a
> couple dozen by now) and at least one them involved not specifying a
> route with 'route' or /etc/sysconfig/network/routes at all. No luck
> there either.


So what is the output of '/sbin/route -n'. It is best to include that
along with output of '/sbin/ifconfig' when you have network or routing
problems. If for some reason the interface does not come up (wrong module
or something) then you are not going to be able to set a route for a
non-existing interface or IP.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
sz
Guest
Posts: n/a

 
      04-13-2004, 03:28 PM
OK, here's the results of 'ifconfig -eth0' and 'route -n' for my
latest non-working configuration. I have an SMC barricade router that
does not support static DHCP (i.e., I can't assign a particular IP
address to a MAC address with it). I've tried this with DHCP both
enabled and disabled on the router.

linux:/etc/sysconfig/network # ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:20:78:05:39:F5
inet addr:192.168.2.11 Bcast:192.168.2.255
Mask:255.255.255.0
inet6 addr: fe80::220:78ff:fe05:39f5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:288 (288.0 b)
Interrupt:10 Base address:0x9000

linux:/etc/sysconfig/network # route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

I can still ping other machines on the LAN, but I can't get outside
this way. Mozilla just gives me a simple "website could not be found"
message. Oh, and here's my 'ifcfg-eth0' configuration for this setup
('routes' is empty):

linux:/etc/sysconfig/network # cat tmp/ifcfg-eth0.new
DEVICE='eth0'
BOOTPROTO='static'
MTU=''
REMOTE_IPADDR=''
STARTMODE='onboot'
IPADDR="192.168.2.011"
NETMASK="255.255.255.0"
GATEWAY='192.168.2.1'
UNIQUE='lgGW.EpgkC3S71D2'
 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      04-13-2004, 03:45 PM
On 13 Apr 2004 08:28:31 -0700, sz wrote:
> OK, here's the results of 'ifconfig -eth0' and 'route -n' for my
> latest non-working configuration. I have an SMC barricade router that
> does not support static DHCP (i.e., I can't assign a particular IP
> address to a MAC address with it). I've tried this with DHCP both
> enabled and disabled on the router.


Your route -n shows you have no default gateway. Except for ip addy it
should look something like

$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

The UG indicates the gateway (192.168.1.1)

I jumped in this thread without reading the whole thread.

If using mandrake or redhat:

I would set gateway device and verify eth0 is set for dhcp.
Your files will look different but should have the <=== entry=value.

cat /etc/sysconfig/network
HOSTNAME=fw.home.invalid
NETWORKING=yes
GATEWAYDEV=eth0 <======

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp <=======
ONBOOT=yes
MII_NOT_SUPPORTED=no
NEEDHOSTNAME=no
DHCP_HOSTNAME="c-24-1-212-248"

I would also set your ISP's DNS servers. Example:
cat /etc/resolv.conf
nameserver 216.148.27.168
nameserver 204.127.502.14

For testing, do a
service network restart
possible errors might be found in /var/log/messages
 
Reply With Quote
 
sz
Guest
Posts: n/a

 
      04-14-2004, 04:46 AM
Bit Twister <(E-Mail Removed)> wrote in message
> If using mandrake or redhat:


Using SuSE 9.0.

> I would set gateway device and verify eth0 is set for dhcp.
> Your files will look different but should have the <=== entry=value.
>
> cat /etc/sysconfig/network
> HOSTNAME=fw.home.invalid
> NETWORKING=yes
> GATEWAYDEV=eth0 <======


Haven't been able to find the config file for these variables in SuSE
yet. YaST doesn't seem to list any of them in sysconfig editor
application it provides.

>
> cat /etc/sysconfig/network-scripts/ifcfg-eth0
> DEVICE=eth0
> BOOTPROTO=dhcp <=======


OK, I thought this looked weird. Why set BOOTPROTO to DHCP when I want
a statically determined IP? I made the change anyway and although I
can get outside the router now, I don't have the IP address I
specified in ifcfg-eth0.

> I would also set your ISP's DNS servers. Example:
> cat /etc/resolv.conf
> nameserver 216.148.27.168
> nameserver 204.127.502.14


Done. Not sure why though.

> For testing, do a
> service network restart


Oooh, I'd love to be able to restart network services without
rebooting, but that command doesn't work with suse. I'll hunt around
for something equivalent.
 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      04-14-2004, 05:06 AM
On 13 Apr 2004 21:46:49 -0700, sz wrote:

> Haven't been able to find the config file for these variables in SuSE


Ok, that is on Redhat, Mandrake
>
> OK, I thought this looked weird. Why set BOOTPROTO to DHCP when I want
> a statically determined IP? I made the change anyway and although I
> can get outside the router now, I don't have the IP address I
> specified in ifcfg-eth0.


I misunderstood your router assigned your ip address. If so dhcp would
be the way to go.


>
>> cat /etc/resolv.conf

>
> Done. Not sure why though.


I you run static you would need them to lookup google and any name.

>
>> For testing, do a
>> service network restart

>
> Oooh, I'd love to be able to restart network services without
> rebooting, but that command doesn't work with suse.



Assumed you tried that as root.

Sorry, never played with Suse.
Ok, try these
/etc/init.d/network restart
or
/etc/rc.d/init.d/network restart

 
Reply With Quote
 
sz
Guest
Posts: n/a

 
      04-14-2004, 05:21 AM
OK, I'm getting somewhere. First, the Suse equivalent to "service
network restart" is "rcnetwork restart". That right there just let we
whip through about 6 different configurations in less than 2 minutes.

Second, the following ifcfg-eth0 file works:

linux:/etc/sysconfig/network # cat ifcfg-eth0
DEVICE='eth0'
BOOTPROTO=static
ONBOOT=yes
NEEDHOSTNAME=no
MTU=''
REMOTE_IPADDR=''
STARTMODE='onboot'
IPADDR="192.168.2.011"
NETMASK="255.255.255.0"
GATEWAY='192.168.2.1'
UNIQUE='lgGW.EpgkC3S71D2'

But only if I manually run 'route add default gw 192.168.2.1' after
restarting the network. I can't figure that out, because
/etc/sysconfig/network/routes already has an entry for the default
gateway:

linux:/etc/sysconfig/network # cat routes
#Kernel IP routing table
#Destination Gateway Genmask Flags Metric Ref
Use Iface

0.0.0.0 192.168.2.1 0.0.0.0 UG 0 0
0 eth0
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0
0 eth0

Or do I need to run some configuration utility to force my system to
see the changes I made in 'routes'?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static multicast routing and NAT JPI Linux Networking 4 04-02-2009 08:33 PM
static routing Robert Windows Networking 15 07-06-2007 02:05 AM
vpn & static routing VPN User Windows Networking 2 01-13-2006 03:42 AM
static routing question oswald Network Routers 1 07-21-2005 08:43 PM
Static Routing Windows Networking 1 12-20-2003 09:12 PM



1 2 3 4 5 6 7 8 9 10 11