1

I have an Ubuntu-box as a gateway with two interfaces. The first one (eth0) is the internal network and has the following address:

eth0: 192.168.1.1/24

The second one is connected to a router from an ISP, to which I don't have access! And, alas, it has 192.168.1.1 as address... So I ended up choosing the following for eth1:

eth1: 192.168.1.240/32

Then adding

route add 192.168.1.1 eth1
ip route add default via 192.168.1.1 dev eth1

But this only works if I change the IP of my gateway on eth0 to 192.168.1.2 or something else. Is there a way to define the routing while keeping 192.168.1.1 on my gateway, too?

PS: Yes, I could reconfigure my internal network to something else, but as there is a Windows-domain-server on it, I don't want to do that.

  • Cmon, this is Linux - there has to be another way! BTW usually I do have different subnets - just this time it would be very hard, as I have the PDC on the 192.168.1.0/24 and more hardcoded IPs than I'd like to. – ineiti Sep 18 '14 at 5:26
  • i don't say you use iptables you implement this with ip route or route command. – PersianGulf Sep 18 '14 at 10:10
  • 1
    The easiest fix, I think, is to insert a new, two-NIC system between eth1 and the ISP router, allocating a new (non-conflicting, this time!) network number for the eth1-NewSystem link. You won't be able to ping the ISP router from your system, but that's a minor issue. If you don't have a system to spare, you can probably accomplish the same thing with a VM running on the host. – Mark Plotnick Sep 18 '14 at 20:06
3

The best solution would be to use two different subnets for your network, one for internal use and one for public/wan use, putting two interfaces in the same subnet will only cause you trouble. If you don't want to change the IP for the Windows DC, I suggest that you split the /24 to two /25, and use one for lower /25 for your internal net, and the upper /25 for your internet/wan connection.

  • Well, I have hardcoded IPs in the 192.168.1.0/25-range, so I can't put that easily to 192.168.1.128/25... And I don't have access to the router, so I can't put that in the 192.168.1.128/25, neither :( – ineiti Sep 18 '14 at 5:27
0

I liked the answer from Mark Plotnick the best:

Insert a system with two NICs that hides the router from the gatewayor

or

Install a virtual machine on the gateway that is attached to the eth0 and an internal interface with another subnet. Then route all traffic through the internal interface. Probably LXC should be most easy, though I never tried it out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.