Solved Enabling a second nic with a different subnet, on a different gateway/network

arbours

Verified User
Joined
Apr 9, 2006
Messages
41
Location
Québec, Montréal
Hi everyone,

I have being researching this a little bit, and of course I found some article and post about doing this, but I've yet fail to succeed so I am coming here to clarify and perhaps find what I am doing wrong.

I have a DA Server, that is a VM (I also run the host). This VM is configured with two NIC, each nic on a separate virtual switch, that has physical access to each of their end-network. We had one nic before, but we want to add a second internet link, to eth1, and while keeping the eth0 as default route, I wanted to bind the eth1 to be one of the ns and then manually add the external ip of eth1 as a second IP on A record for some website. Is this clear up to now ?

eth0: default route (gw 1.2.3.1) / direct external ip, say 1.2.3.4 / work fine
eth1: non default (gw 172.16.1.1) / 172.16.1.2 lan ip <--port 80,443 --> router / external ip 5.6.7.8 / doesnt work from outside, but work internally within the lan with 172.16.1.2.

I have worked already with VM and Lan and Non-Lan setup, such as creating a virtual interface, example: eth0:1 eth0:2, etc.

I have read in my research that I should be doing exactly this, add my lan ip 172.16.1.2 as eth1, and then create a fake alias with the same IP as eth0:1, and then add this ip into directadmin. I feel that this way to do it is mean for external ip. My second internet connection is provided by a router, and port are being forwarded. I tested the port forward with the host directly, with a tcp service to ensure that the port redirection is done properly.

I have a router that I can do snat and dnat manually for the eth1,

example of my routing table : (Note that I have tried to use DEFROUTE=no on eth0:1, I have tried with or without a eth0:1, etc, now I am just back to eth0=1.2.3.4 eth0:1=172.168.1.2 and eth1=172.168.1.2)
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 1.2.3.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 172.16.1.1 0.0.0.0 UG 0 0 0 eth1
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

Any insight or anyone with experience with such setup, it would be highly appreciated :) ?
 
Actually, it does seem to be a route problem... if I set the 0.0.0.0 route to go through 172.16.1.1, it does work, but only if I remove the 0.0.0.0 route for the eth0 1.2.3.1....

I am confuse as to how should I route both ip traffic properly while keeping eth0 as default for traffic but still route traffic for eth0 and eth1 properly
 
Back
Top