Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: ubuntu router for 2 networks

  1. #1
    Join Date
    Nov 2013
    Beans
    7

    ubuntu router for 2 networks

    Hi,

    i'm new here. So please be a little bit patient.
    I searched this topic about 2 days and couldn't found any solution for me. So I want to try it here.

    I have the following configuration:

    Gateway:
    192.168.151.1

    Workstation:
    192.168.150.10

    Interfaces:
    auto eth0
    iface eth0 inet static
    address 192.168.151.55
    netmask 255.255.255.0
    network 192.168.151.0
    broadcast 192.168.151.255
    gateway 192.168.151.1

    auto eth1
    iface eth1 inet static
    address 192.168.150.2
    netmask 255.255.255.0
    network 192.168.150.0
    broadcast 192.168.150.255
    gateway ?.?.?.?

    resolve.conf:
    nameserver IP_OF_NS1
    nameserver ÎP_OF_NS2

    cat /proc/sys/net/ipv4/ip_forward
    1

    gateway x.x.151.1 is working and Ubuntu can reach internet over eth0

    What do I have to do, to connect my workstation to the gateway?
    I don't know what I do have to set as gateway for eth1 or what else I must do.

    any ideas?

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: ubuntu router for 2 networks

    Can you draw out a simple diagram of exactly how you have the machines connected together?

  3. #3
    Join Date
    Nov 2013
    Beans
    7

    Re: ubuntu router for 2 networks

    is this ok?



    192.168.150.x should be connected to 151.x with no limits. And it should work in both directions.

  4. #4
    Join Date
    Feb 2009
    Location
    Singapore
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ubuntu router for 2 networks

    Based on assumption, you need the following:

    1. You need static router on the internet-router for 192.168.151.x to communicate 192.168.150.x.
    2. Run
    Code:
    # /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    on ubuntu server. That was assuming you didn't have any DROP policy.

  5. #5
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: ubuntu router for 2 networks

    Will that go both directions, or just one?

  6. #6
    Join Date
    Nov 2013
    Beans
    7

    Re: ubuntu router for 2 networks

    Quote Originally Posted by nebileix View Post
    ... That was assuming you didn't have any DROP policy.
    It's a blank new ubuntu 12.04.3 server.
    Only OpenSSH is installed and I have configured nothing else but eth0/1 (as seen above)

  7. #7
    Join Date
    Feb 2009
    Location
    Singapore
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ubuntu router for 2 networks

    1. I mean static route. Your internet-router should have the option to configure that. You need to specify the network(192.168.150.0)/netmask(255.255.255.0) and gateway (should be your eth0 ip on your ubuntu server).
    2. Should enable 192.168.150.x to reach 192.168.151.x. the iptables command basically route all unknown traffic to upstream router(internet-router)

  8. #8
    Join Date
    Nov 2013
    Beans
    7

    Re: ubuntu router for 2 networks

    I tried some configurations and it looks like it now works for some tasks.

    1. I did the iptables from nebileix

    2. I set the gateway of eth1 to 192.168.151.1

    3.
    At the workstation I set the following:
    IP: 192.168.150.10
    Mask: 255.255.255.0
    Gateway: 192.168.150.2 (ubuntu)

    Internet, Windows-Update etc. work fine.

    But: ping from 151.x <-> 150.x still doesn't work. But that's not so important to me at the moment. Would be great to solve this too, but for now internet on 150.x is ok

  9. #9
    Join Date
    Feb 2009
    Location
    Singapore
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ubuntu router for 2 networks

    2. I set the gateway of eth1 to 192.168.151.1 <=== shouldn't be required.

    But: ping from 151.x <-> 150.x still doesn't work. But that's not so important to me at the moment. Would be great to solve this too, but for now internet on 150.x is ok <== consult your internet-router documentation on how to configure static route.

  10. #10
    Join Date
    Nov 2013
    Beans
    7

    Re: ubuntu router for 2 networks

    Quote Originally Posted by nebileix View Post
    1. I mean static route. Your internet-router should have the option to configure that.
    I don't have access to the internet-router. So no option.

    but: ping from 150 to 151 works now (at first I only tired hostnames instead of IPs....). Remote-Desktop also works
    ping form 151 to 150 is still not possible.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •