Need help getting a linux client to ping WAN side


Recommended Posts

Hello all!

Apologies if this is a really stupid error I've made in here somewhere but I'm still really new to the linux networking world - only just getting back into it after a long time with windows.

I've got a setup in Virtual box with the following:

Linux server (mint). Acts as DHCP server.

  • eth0 IP: 192.168.1.1 (static)
  • eth1 IP: 192.168.15.12 (obtained by DHCP from my main LAN which in this case, would be the "WAN" I'm trying to get the client to connect to)
  • has 2 network adapters, eth0 (LAN) and eth1 (WAN).
  • Adapter 1 (eth0) settings in virtual box are set to "internal network", promiscuous mode: deny
  • Adapter 2 (eth1) settings in virtual box are set to "bridged adapter" , promiscuous mode: deny

Linux client (mint).

  • IP: 192.168.1.10, assigned by DHCP by the server above

The problem:

From the server I can successfully ping the client and also the "wan" being my main physical network, which is the 192.168.15.x network. Everything seems to work how it should

The client, however, can ping the server, but nothing on the "wan". If I try and ping 192.168.15.1, I get a destination host unreachable error. The traceroute makes it to the server and stops there.

My guess is, I've set routing or iptables up wrong but not sure where I've gone wrong.

Here are some links to pastebins of the contents of my config files on the server:

The iptables command I used was:

sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

 

If anyone can help me see what mistake I've made or something I've missed I would be very grateful! :D

Ok so after googling for a while I came across someone with the same issue and found the fix!!

 

Even though it's working now I'll post the fix here incase anyone else has the same issue: 

 

Adding the line:

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

into /etc/rc.local is necessary to make forwarding work, even if the command has been run before

 

Could anyone explain why this needs to be added even though I've run the same command as root previously?

The iptables command is not persistent, the rules are lost on reboot. You must use iptables-save and iptables-restore (or the iptables-persistent package) or use a frontend like ufw that automates that for you.

You can also do it on rc.local but usually if you have a complex set of rules you'd want to keep it more organized on it's own config file.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This tool is for ripping CDs not burning them. So it's to save cd audio tracks as files. Simple old tool to do it. For burning I used to use Nero Burning Tools back in the day rather than the ones you listed.
    • "The company has recently announced the forming of a new agentic AI team to develop an agentic AI framework for use in robotics." I wonder if any of their executives attented, "Microsoft Build 2025" last month?
    • Microsoft Build conference to leave Seattle after years in the city by Pradeep Viswanathan Microsoft Build is a flagship annual developer conference held by Microsoft since 2011. In 2017, Microsoft relocated Build from San Francisco to its home turf in Seattle. The proximity to its main campus allowed greater participation from its own engineers and executives, offering attendees a more integrated experience. Today, Jonathan Choe revealed on X that Microsoft has decided to move its Build developer conference out of Seattle. He discovered this information via an email sent by Visit Seattle to its members. Visit Seattle is a private, non-profit destination marketing organization that promotes travel to Seattle and King County. As a result of the move, Seattle-based hotels could lose approximately 9,314 room nights annually. Surprisingly, Visit Seattle’s message included several details about Microsoft’s reasons for the change. The primary reason appears to have come from within Microsoft itself. The company feels that Build lost momentum post-COVID, and the scheduling conflict with Google I/O, a competing event, has made it harder to attract the intended audience. Microsoft’s leadership believes they can better re-energize the program and boost attendance by moving it out of Seattle. The note even suggests that Build will likely be relocated to San Francisco or Las Vegas in 2026. Another factor contributing to the decision is the condition of the city. Last month, during the conference, Microsoft leadership and attendees walked between the Hyatt Regency and the Arch building on 8th Street. Reportedly, there were complaints about the general uncleanliness of the area, the visible presence of individuals using drugs, and unhoused individuals in a recurring tent in the Arch Tunnel. Visit Seattle believes these concerns also played a role in Microsoft’s final decision to relocate Build. Given Microsoft's high-profile presence and the economic impact of the event, this relocation may spark a political storm within the Seattle mayor’s office, drawing criticism over the city’s handling of downtown conditions.
    • This is very exciting, happy to see it come back to RC.
    • What did you have to do for that? Are the steps similar to W10?
  • Recent Achievements

    • One Year In
      Vladimir Migunov earned a badge
      One Year In
    • One Month Later
      daelos earned a badge
      One Month Later
    • Week One Done
      daelos earned a badge
      Week One Done
    • Mentor
      Karlston went up a rank
      Mentor
    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      493
    2. 2
      snowy owl
      252
    3. 3
      +FloatingFatMan
      250
    4. 4
      ATLien_0
      220
    5. 5
      +Edouard
      169
  • Tell a friend

    Love Neowin? Tell a friend!