Link to home
Start Free TrialLog in
Avatar of dplinnane
dplinnaneFlag for United States of America

asked on

Linux Networking static ip WRT54G linksys router

I found this solution to seta static ip address

If you want to be able to assign the linux machine a static IP, you need to:

1. Go into your routers configuration - 192.168.1.1
2. Click the DHCP tab
3. Set starting IP address to something like 192.168.100
   *The important part is that you assign a static IP outside of this range.
4. Apply settings.
5. Assign your linux machine an IP lower than 192.168.1.100 (or lower than whatever you set that value in step 3) try 192.168.1.50

I have carried out the following to a linux1 and a linux2 box.  http://www.oracle.com/technology/pub/articles/hunter_rac10gr2.html#7

of when I uncheck the box use DHCP and check static ip  on network setting on linux box I cannot connect to the internet. When I check dhcp I can connect. Using the command ifconfig tells me I have an ip address of 192.168.1.nnn where nn is any number greater then 100.  HOW can I make it work so that I can set the network setting to static ip address as below and connect everytime without having to check dhcp.
Thanks in advance.

Server 1 (linux1)
Device IP Address Subnet Purpose
eth0 192.168.1.100 255.255.255.0 Connects linux1 to the public network
eth1 192.168.2.100 255.255.255.0 Connects linux1 (interconnect) to linux2 (int-linux2)
/etc/hosts
127.0.0.1        localhost      loopback

# Public Network - (eth0)
192.168.1.100    linux1
192.168.1.101    linux2

# Private Interconnect - (eth1)
192.168.2.100    int-linux1
192.168.2.101    int-linux2

# Public Virtual IP (VIP) addresses for - (eth0)
192.168.1.200    vip-linux1
192.168.1.201    vip-linux2

 


Server 2 (linux2)
Device IP Address Subnet Purpose
eth0 192.168.1.101 255.255.255.0 Connects linux2 to the public network
eth1 192.168.2.101 255.255.255.0 Connects linux2 (interconnect) to linux1 (int-linux1)
/etc/hosts
127.0.0.1        localhost      loopback

# Public Network - (eth0)
192.168.1.100    linux1
192.168.1.101    linux2

# Private Interconnect - (eth1)
192.168.2.100    int-linux1
192.168.2.101    int-linux2

# Public Virtual IP (VIP) addresses for - (eth0)
192.168.1.200    vip-linux1
192.168.1.201    vip-linux2

 

Note
Avatar of noci
noci

If you dont use DHCP, what is the gateway?

use netstat -rn
to check on the server.
if ther is no line like

0.0.0.0 192.168.1.1  0.0.0.0 UG 0 0 0 eth0

there then the gateway is not set and packets for the internet won't go to you linksys
Avatar of dplinnane

ASKER

Started my linux up ran
1. ifconfig
2. netstat -rn
tried to connect to internet
no connection
checked enable dhcp
able to connect reran steps 1 and 2 results below.

WHAT DO I NEED TO DO?

[root@linux2 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:13:72:C4:32:7F
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:72ff:fec4:327f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:484 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:36148 (35.3 KiB)  TX bytes:630 (630.0 b)

eth1      Link encap:Ethernet  HWaddr 00:14:BF:54:A2:51
          inet addr:192.168.2.101  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe54:a251/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:630 (630.0 b)
          Interrupt:193 Base address:0x6400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6191 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6191 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8481314 (8.0 MiB)  TX bytes:8481314 (8.0 MiB)

[root@linux2 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
[root@linux2 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:13:72:C4:32:7F
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:72ff:fec4:327f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:619 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:47036 (45.9 KiB)  TX bytes:1314 (1.2 KiB)

eth1      Link encap:Ethernet  HWaddr 00:14:BF:54:A2:51
          inet addr:192.168.2.101  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe54:a251/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:630 (630.0 b)
          Interrupt:193 Base address:0x6400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6194 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8481470 (8.0 MiB)  TX bytes:8481470 (8.0 MiB)

[root@linux2 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
[root@linux2 ~]#

Compare Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1


with this
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0

The missing line is indeed:
the line with 0.0.0.0 when you setup manualy...

When configuring eth0:
(figure 3)
Look very careful to also fillout The bottom field: Gateway as this will add
extra routing entry.
The field after "Default Gateway address", If you specifiy DHCP it part of what is sent to your system,
if you setup manually thenyou need to suply it. The default Gateway is not needed for local access.
ALso leave the default gateway address in eth1 empty!
As per figure 4.
The good news is that LINUX2 works. I think the main reason is that I reset my linkskys mode to start from 168.192.1.50 and limit it to 49 DHCP users.
See below for LINUX1 comments.

[root@linux2 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
[root@linux2 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:13:72:C4:32:7F
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:72ff:fec4:327f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:138 errors:0 dropped:0 overruns:0 frame:0
          TX packets:145 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18151 (17.7 KiB)  TX bytes:11921 (11.6 KiB)

eth1      Link encap:Ethernet  HWaddr 00:14:BF:54:A2:51
          inet addr:192.168.2.101  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe54:a251/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:630 (630.0 b)
          Interrupt:193 Base address:0x6400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6213 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6213 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:8714466 (8.3 MiB)  TX bytes:8714466 (8.3 MiB)

[root@linux2 ~]#


########################## LINUX1 #####################################

[root@linux1 ~]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
[root@linux1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:13:72:D1:A7:AF
          inet6 addr: fe80::213:72ff:fed1:a7af/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1476 (1.4 KiB)  TX bytes:420 (420.0 b)

eth1      Link encap:Ethernet  HWaddr 00:14:BF:54:A2:6A
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe54:a26a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:630 (630.0 b)
          Interrupt:193 Base address:0x6400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6092 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6092 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7969414 (7.6 MiB)  TX bytes:7969414 (7.6 MiB)

#########################################
I checked DHCP   and reran ifconfig and it grabs ip address 192.168.1.51   and I can not connect to the internet.
At the same time I noticed my laptop had an IP address of  192.168.1.100.  Two machines can'thave the same ip so maybe that's why LINUX1 fails. The laptop IP was grabbed before I reset linksys router.  I guessed that if I set the LINUX1 to 192.168.1.110 for etho and 192.168.2.100 for ETH1 and rebooted it may work. Low and behold after checking static ip check box modifying to new ip address and restarting LINUX1 that it had an ip address of 192.168.1.110 and I was able to connect to the internet.
I'm guessing that if I reset it back to 192.168.1.100 with my laptop disconnected it will still work or even if I have my laptop connected it will grab lowestip address
192.168.1.51.   Am I making sense. I will check the following when I go home, may have a few more questions before I close out.

 ifconfig
eth0      Link encap:Ethernet  HWaddr 00:13:72:D1:A7:AF
          inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:72ff:fed1:a7af/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:465 errors:0 dropped:0 overruns:0 frame:0
          TX packets:438 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:406668 (397.1 KiB)  TX bytes:77999 (76.1 KiB)

eth1      Link encap:Ethernet  HWaddr 00:14:BF:54:A2:6A
          inet addr:192.168.2.100  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::214:bfff:fe54:a26a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:630 (630.0 b)
          Interrupt:193 Base address:0x6400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6095 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6095 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7969570 (7.6 MiB)  TX bytes:7969570 (7.6 MiB)

######################## LAPTOP ##########################################
C:\Documents and Settings\plinnane>ipconfig/all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : plinnane-us
        Primary Dns Suffix  . . . . . . . : us.oracle.com
        Node Type . . . . . . . . . . . . : Hybrid
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No
        DNS Suffix Search List. . . . . . : us.oracle.com
                                            austin.rr.com
                                            oracle.com

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . : austin.rr.com
        Description . . . . . . . . . . . : Broadcom NetXtreme 57xx Gigabit Controller
        Physical Address. . . . . . . . . : 00-15-C5-0A-D5-85
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 192.168.1.100
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        IP Address. . . . . . . . . . . . : fe80::215:c5ff:fe0a:d585%20
        Default Gateway . . . . . . . . . : 192.168.1.1
        DHCP Server . . . . . . . . . . . : 192.168.1.1
        DNS Servers . . . . . . . . . . . : 24.93.41.125
                                            24.93.41.126
                                            fec0:0:0:ffff::1%4
                                            fec0:0:0:ffff::2%4
                                            fec0:0:0:ffff::3%4
        Lease Obtained. . . . . . . . . . : Wednesday, July 19, 2006 9:04:23 PM
        Lease Expires . . . . . . . . . . : Thursday, July 20, 2006 9:04:23 PM

Tunnel adapter Teredo Tunneling Pseudo-Interface:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
        Physical Address. . . . . . . . . : FF-FF-FF-FF-FF-FF-FF-FF
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : fe80::5445:5245:444f%5
        Default Gateway . . . . . . . . . :
        NetBIOS over Tcpip. . . . . . . . : Disabled

Tunnel adapter Automatic Tunneling Pseudo-Interface:

        Connection-specific DNS Suffix  . : austin.rr.com
        Description . . . . . . . . . . . : Automatic Tunneling Pseudo-Interface
        Physical Address. . . . . . . . . : C0-A8-01-64
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : fe80::5efe:192.168.1.100%2
        Default Gateway . . . . . . . . . :
        DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%4
                                            fec0:0:0:ffff::2%4
                                            fec0:0:0:ffff::3%4
        NetBIOS over Tcpip. . . . . . . . : Disabled
ASKER CERTIFIED SOLUTION
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
btw your current setup should be OK because the hight DHCP addres now can be 99, that's safe.
Great job everythinG is now working.