Solved

Linux Networking static ip WRT54G linksys router

Posted on 2006-07-19
8
288 Views
Last Modified: 2010-03-18
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
0
Comment
Question by:dplinnane
  • 5
  • 3
8 Comments
 
LVL 39

Expert Comment

by:noci
ID: 17142144
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
0
 

Author Comment

by:dplinnane
ID: 17143296
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 ~]#

0
 
LVL 39

Expert Comment

by:noci
ID: 17143971
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.
0
 
LVL 39

Expert Comment

by:noci
ID: 17144184
ALso leave the default gateway address in eth1 empty!
As per figure 4.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:dplinnane
ID: 17149279
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
0
 
LVL 39

Accepted Solution

by:
noci earned 500 total points
ID: 17149968
Yes you are making sense.

The notes for setup also told you you neede to setup DHCP above 192.168.1.100, so the latptop should have hade a much higher address.
Manual issued addresses should allways be OUSIDE any DHCP range to prevent conflicts.

And yes two system cannot realy share ONE ip address.

It depend on the algorithms on both systems. It might happen that the BOTH turn off their interfaces in case of conflict. It might also be
that that latest system does that, but only when the interface is being setup.
(ifconfig up first does an address check, and if that fails configures the address)
if both system have their static address allready setup (or have a long term lease from DHCP) then
I won't guess which system passes out.

0
 
LVL 39

Expert Comment

by:noci
ID: 17150094
btw your current setup should be OK because the hight DHCP addres now can be 99, that's safe.
0
 

Author Comment

by:dplinnane
ID: 17151058
Great job everythinG is now working.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ACK Attack 5 57
Open BDS Pf 3 44
linux, squid server 23 48
centos7 firewalld udp ports 33 57
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now