LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Two interfaces routing problem, Debian, kernel 2.4 (https://www.linuxquestions.org/questions/linux-networking-3/two-interfaces-routing-problem-debian-kernel-2-4-a-679791/)

clintp 10-29-2008 11:24 AM

Two interfaces routing problem, Debian, kernel 2.4
 
I have AT&T U-Verse as my provider. The routing device they supply has a quirk that's making life difficult.

To pass all incoming requests to a device on my network, that device has to have a dynamic IP. I'm fine with that. However, that device I also use for other things on the internal network. As its address changes, the internal machines (mix of linux/windows) need to have the new address given to them and that's a pain.

So I installed a second interface. This interface I've given a static IP address (192.168.1.13), and have pointed my internal machines to it for services.

The problem is this: that box can no longer communicate outside my network (no internet). Internally, everything's fine. Externally, nothing.

Here's the ifconfig:

Code:

eth0      Link encap:Ethernet  HWaddr 00:C0:4F:72:E1:FF
          inet addr:192.168.1.13  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:785094 errors:0 dropped:0 overruns:166 frame:0
          TX packets:112220 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:150695813 (143.7 MiB)  TX bytes:22274993 (21.2 MiB)
          Interrupt:19 Base address:0xdc00

eth1      Link encap:Ethernet  HWaddr 00:50:BF:16:92:70
          inet addr:99.13.10.182  Bcast:99.13.11.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:598193 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44946 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:46530563 (44.3 MiB)  TX bytes:5414705 (5.1 MiB)
          Interrupt:17 Base address:0xc00

And the routing table (route -n):

Code:

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
99.13.8.0      0.0.0.0        255.255.252.0  U    0      0        0 eth1
0.0.0.0        99.13.8.1      0.0.0.0        UG    0      0        0 eth1
0.0.0.0        192.168.1.254  0.0.0.0        UG    0      0        0 eth0

Where have I screwed this up, and how do I fix it?

jonaskoelker 10-29-2008 08:25 PM

try
Code:

# ip route del default dev eth0
Quote:

So I installed a second interface.
Unless your hardware is weird (i.e. old), you can have multiple IP addresses on the same NIC.
Code:

# ifconfig eth0:internal 192.168.0.1
Note that in some cases (multipath routing, for one), "ip route" shows more information than "route" :)

jlarson 10-30-2008 08:14 AM

/etc/network/interfaces
 
I'm not sure of where your distro stores network settings, but this is what I would do with /etc/network/interfaces in debian:

Code:

auto eth0
iface eth0 inet static
        address 192.168.1.13
        netmask 255.255.255.0
auto eth0:0
iface eth0:0 inet dhcp

Then:

Code:

/etc/init.d/networking restart
You shouldn't need multiple NICs.

clintp 10-30-2008 01:58 PM

Deleting the route worked.
 
Quote:

Originally Posted by jonaskoelker (Post 3325630)
try
Code:

# ip route del default dev eth0

Unless your hardware is weird (i.e. old), you can have multiple IP addresses on the same NIC.
Code:

# ifconfig eth0:internal 192.168.0.1
Note that in some cases (multipath routing, for one), "ip route" shows more information than "route" :)

Deleting the route worked. I don't know why I didn't think of that. (Although "ip" isn't a valid command on this distribution. "route del..." did the trick.)

I tried using two addresses for the same NIC but for some reason, I couldn't get it to use DHCP on one and static on the other. Since the machine already had another NIC card in it (from when it functioned as my firewall) enabling the second one wasn't a big deal.

jonaskoelker 10-31-2008 12:24 AM

Quote:

I tried using two addresses for the same NIC but for some reason, I couldn't get it to use DHCP on one and static on the other.
Try doing the dhcp request first and the static assignment later; I wouldn't be surprised if your dhcp daemon drops all configuration from the interface when first started, including aliased IP addresses.
(Sorry, I'm too lazy to test this myself)

Code:

auto eth0
iface eth0 inet dhcp
auto eth0:0
iface eth0:0 inet static
        address 192.168.1.13
        netmask 255.255.255.0



All times are GMT -5. The time now is 01:21 PM.