Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    [SOLVED] Routing a subnet with public IPs

    Hi there, I have a problem with making a subnet of public IPs on machines that are inside my LAN accessible from internet.

    This is my setup:

    1. Router PC - connected to
    a) eth0 - - LAN, with IP
    b) eth2 - DHCP'd provider's network
    c) ppp0 - PPPoE link to provider - WAN, with IP

    2. A host in my LAN with IP with VMWare on it, with networking set up as 'bridged' - giving direct access to LAN for all virtual machines.

    3. A set of virtual machines, running on a previously mentioned host.

    4. A subnet, where I have 6 IP addresses.

    I need to give IP's from the mentioned subnet to virtual machines, and make them available from internet.

    I'm somewhat lost in all routing stuff, so I'd appreciate any help, thanks!

    UPD: so far I've got this souting table on a router PC

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface * UH 0 0 0 ppp0 UG 0 0 0 eth0 * U 10 0 0 eth0 * U 0 0 0 eth2
    link-local * U 10 0 0 eth0
    loopback * U 0 0 0 lo
    default UG 0 0 0 ppp0

    where is my ISP's PPPoE gateway.

    I am able to ping/trace addresses from router PC, but from other machines in LAN router answers 'Destination host unreachable'.

  2. #2
    Okay, it's solved - using DNAT+SNAT:

    iptables -t nat -I POSTROUTING -s -j SNAT --to-source iptables -I FORWARD -s -j ACCEPT
    iptables -I FORWARD -d -j ACCEPT
    iptables -t nat -A PREROUTING --dst -j DNAT --to-destination
    iptables -t nat -A POSTROUTING --dst --src -j SNAT --to-source
    iptables -t nat -A OUTPUT --dst

    where xxx is one of the subnet's IPs, which is now feeling OK in the internet

Posting Permissions

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