Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Linux Router- No NAT

Rumi, May 7, 2018

I assume you have one public IP address for your WAN side, and a block for the LAN side, something like this:

ISP-----ROUTER ETH0/ROUTER ETH1------SWITCH------PCs

You NEED to have a public IP address for the WAN interface, ISP will route the subnet they have given you through this IP address. Simply you need to set the forwarding bit to 1

echo 1 > /proc/sys/net/ipv4/ip_forward

To make it persistent you need to edit /etc/sysctl.conf, find this line:

net.ipv4.ip_forward=0

and change it to

net.ipv4.ip_forward=1

Make sure to uncomment it if commented. Now, all you need to do is set your pc’s default gateway to point to the linux router and assuming the ISP has done their work by routing the block through the public ip address for your lan side.

Now. If all you have is a public address block… you’re not looking into routing, just hook the ISP to a switch and all the PCs to the switch and it should be done. If you can specify more details we might be able to help you more.

With IPv6

You say your interfaces are configured as follows:

wan: 2800:40:403::1/48
lan: 2800:40:403::3/48

What is your default gateway? I guess 2800:40:403::2/48

It shouldn’t really work like this. I haven’t worked with IPv6 yet but you have the two interfaces in one subnet, I guess I will allow you to configure that but say a Cisco router would at least warn you about the overlap

Easiest solution is all the PCs go to a switch connected to the ISP.

The real solution is tell the ISP to give you 1 public address on their address space for WAN and to route the block through that address. Then all you have to do is configure:

wan: ip-from-their-space
lan: 2800:40:403::1/48

And all the lan PCs should point to that one as default.

You have a very large address space, what you could do is further subnet it.

With Bridge Interface

If you really want to bridge the interfaces you can do it without anything IP related. You will only have one interface with an IP address that way.

All you need to do is install bridge-utils, then you configure it this way:

ip add flush dev eth0
ip add flush dev eth1
brctl addbr br0
brctl addif br0 eth0 eth1
ip link set dev br0 up

Then configure your IPv6 address on br0 instead and now you have a transparent bridge. It still doesn’t solve your IPv4 problem but you could solve it this way:

Configure IPv4 public and private address on br0, and NAT this way:

iptables -t nat -A POSTROUTING -j SNAT -s / --to-source

Src: https://serverfault.com/questions/400395/linux-as-a-gateway-no-nat

Administrations CentOSLinux Router

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx openvpn pfsense php Postfix Proxmox RDP Softether SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin Windows 10 XCP-NG zimbra

Topics

Recent Posts

  • KVM Cloud Capacity Planning Script (Enhanced) February 20, 2026
  • Youtube MP3 Downloader Script using AI February 14, 2026
  • Install Softether VPN and create a Destination NAT (D-NAT) Rule to access the private Client VPN Node on a Debian 12 OS February 14, 2026
  • Deploying Pulse Monitoring for Proxmox Cluster Ecosystem February 13, 2026
  • Technitium DNS Web UI Configuration for Primary-Secondary Name Servers February 12, 2026
  • Technitium DNS with Primary-Slave Installation on Debian February 12, 2026
  • Install Docker and Docker Compose in Debian 12 February 5, 2026
  • Install GUI on Debian 12 using CLI February 4, 2026
  • Configuring Multiple PHP Versions on Virtualmin January 30, 2026
  • Deploy a Container TIG (Telegraf, InfluxDB and Grafana) Stack January 24, 2026

Archives

Top Posts & Pages

  • KVM Cloud Capacity Planning Script (Enhanced)
©2026 Bots! | WordPress Theme by SuperbThemes