LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   2 NICs, 2 external IP's (1 behind a router) (https://www.linuxquestions.org/questions/linux-networking-3/2-nics-2-external-ips-1-behind-a-router-2663/)

yskwong 05-21-2001 03:00 PM

2 NICs, 2 external IP's (1 behind a router):

I have a Linux PC setup as a standalone machine, running RedHat 6.2 Professional. It has an ethernet connection eth0 and is connected to the web via an external IP (say 24.65.xxx.xxx).

For some reasons, I need to provide a way for PCs on an internal office LAN to access this Linux PC as a special server. The PCs on internal LAN are connected together via a Linksys Cable/DSL Router (BEFSR81 with an integrated 8-port 10/100 switch), which provides both a switch for the LAN and a connection to the web via another separate external IP (say 24.68.yyy.yyy).

So I put in another NIC into the Linux PC, and configured it as eth1 to connect to the internal LAN via the Linksys router/switch. The Linksys router is setup with DHCP disabled, and IP addresses for PCs on the LAN being assigned manually: the router with an internal IP of 192.168.1.1, eth1 of Linux PC with an internal IP of 192.1.30, and a Windows 2000 PC on the LAN with an internal IP of 192.168.1.10.

On reboot all PCs and router, everything seems to working fine with the following expected behavior:

1. From the Linux PC:
a. I can browse external web sites via eth0 through external IP 24.65.xxx.xxx
b. I can talk to a Windows 2000 PC on LAN via eth1, look at its web site thru http://192.168.1.10/ or an internal name assigned via /etc/hosts.
2. From an external PC outside the LAN:
a. I can browse the Linux PC through a domain name mapped to 24.65.xxx.xxx (the IP for eth0).
b. I can browse the Windows 2000 PC via another domain name mapped to the router’s external IP 24.68.yyy.yyy, with port 80 forwarded to this particular PC.

However, after running for a while, things seem to go wrong for no particular reasons that I know of:
1. From the Linux PC, when I browse an external web site (that reports on your originating IP address), I find that I am accessing thru eth1 and the router, as the external site is reporting my router external IP address.
2. From an external PC, I can no longer access the web server on the Linux PC, associated with the domain name mapped to 24.65.xxx.xxx (the IP for eth0).
3. Sometimes, even the web site on the Windows 2000 PC associated with the router external IP 24.68.yyy.yyy is not accessible.

On rebooting the Linux PC, everything is then back to normal, with expected behavior as described in the preceding paragraph.

QUESTIONS ARE:

1. What is causing the Linux PC to switch to using eth1 (from eth1) on accessing the Internet? Any workaround?
2. Why are the domain names or the external IP’s associated with Linux PC and the router can become inaccessible? Any workaround?

Thanks for any assistance you might offer!

unSpawn 05-21-2001 04:27 PM

Cant lay my finger on it but I think its routing/metric.
I would try adding default static routes for external connection tru eth0, and another default route set up for accessing LAN tru eth1.
Curious if this would make a difference.

yskwong 05-23-2001 10:25 AM

Hi: Thanks for the suggestion. Can you help with how to add the default static routes you suggested?

When I do a "route" command, the Kernal IP table is as follow on bootup when things are working as expected.

It remains the same on issuing another "route" command when the PC no longer has the expected behavior. At this point, I can no longer reached the web server of this PC from an external PC on browsing either with its external IP: 24.64.145.54, or thru its domain name. But I can still ping the IP or domain name with response.

Kernal IP Routing Table

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.30 * 255.255.255.255 UH 0 0 0 eth1
24.64.145.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth1
default 24.64.145.1 0.0.0.0 UG 0 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 1 0 0 eth1


#! 05-23-2001 10:38 AM

Hi,

I think your problem is that you need to download a patch from the Linksys site that fixes a bug prevalent in those routers. The bug fits the description of your situation. One person I know said that after awhile, it just stopped messing up on him

Good luck.

yskwong 05-24-2001 09:43 AM

Hi:

I tried the suggestion the problems might be due to Linksys router. I upgraded the Linksys router to the latest version of firmware dated May, 2001. The problems did not go away. So I guess it is not due to the router. Thanks anyway.

unSpawn 05-25-2001 07:22 AM

I think it goes like this.
for lan network over device:
/sbin/ifconfig eth0 inet (net.wrk.adr) netmask (netmask)
/sbin/route add -net (net.wrk.adr) netmask (netmask) dev eth0
*i dont know if this needs adding a default gw, so try.
for ext network over device:
/sbin/ifconfig eth1 inet (net.wrk.adr) netmask (netmask)
/sbin/route add -host (gw.ip.adr) eth1
/sbin/route add default gw (gw.ip.adr) netmask (netmask) dev eth1
plz consult man route on this ok...

if uve got it these lines ok, they could be entered into
/etc/sysconfig/static-routes, or run off a runlevel script or network start/ifup script.

check if uve got gated/routed running,
they might also be culprits in changing routes...

HTH...


All times are GMT -5. The time now is 09:22 PM.