0

Let's assume we've got some system with 2xEthernets (eth0 and eth1) and one WLAN (wlan0) interface working on Linux. I'd like to make bridge interface br0 with eth0 and eth1 attached into it and in the same time make SNAT on this br0 interface for wlan0 interface.

I'd like to share access to the internet (from my ISP from eth0) directly to eth1 and with SNAT to wlan0. So only my PC on eth1 would have direct access to internet but other computers only via SNAT and wlan0 interface?

In other words I'd like to have:

  • eth0 connected directly to my WAN of ISP router/bridge with global internet address
  • eth1 for direct connection of my PC to the internet
  • wlan0 after the SNAT where everyone could have access to internet via WiFi

Is it possible to achieve this configuration working on Linux?

4
  • How many (usable host) IP addresses has your ISP allocated you Dec 8, 2023 at 9:29
  • I'm planning to request one global IP address from my ISP. Dec 8, 2023 at 10:09
  • Will that give you one usable address or more? Dec 8, 2023 at 10:22
  • I think ISP can assign me only 1 IP usable address. Dec 8, 2023 at 10:24

1 Answer 1

0

We have two statements to consider:

  1. my PC on eth1 would have direct access to internet but other computers only via SNAT and wlan0 interface

  2. I think ISP can assign me only 1 IP usable address. –

and then you ask if this is possible on Linux.

Fundamentally this is not possible with a single IP address unless you are prepared to NAT/Masquerade all your devices. You cannot give your PC the Internet address and also use it to NAT the other devices. (Well, I suppose you might be able to do something with proxy arp, but how that would interact with the connection tracking required to NAT the other devices is anyone's guess.)

What you can do though is to run NAT/Masquerade on your primary Linux router system and port forward incoming requests to your PC. Most Home/SOHO routers will do this out of the box so at this point you might prefer to save the effort and use one of those.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .