0

Computer A accesses internet through wifi interface wlp2s0 connected to a router (Internet).

  • WAN network 192.168.1.0/24
  • Only responds to Computer A's MAC address DHCP discover requests

Computer A's second network interface enp3s0 is used by Computer B reach out Internet through the A's NAT.

  • LAN network 192.168.45.50/24

Computer B uses this connection to access Internet. For this, dnsmasq is running as DHCP server on computer A with configuration to listen on any interfaces over than wlp2s0.

Current setup

enter image description here

How do I remove wifi interface from this setup to only use enp3s0 - with switch?

Desired setup

enter image description here

Current config (Computer A)

Ubuntu 18.04 is installed on Computer A. netplan does not handle enp3s0, it its configured manually during boot:

iptables -t nat -A POSTROUTING -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1

ip link set enp3s0 up
ip addr add 192.168.4.50/24 dev enp3s0

And then dnsmasq starts to listen on this interface with appropriate subnet in its config.

What are config options for dnsmasq to prevent DHCP server interfering with DHCP client on the same interface?

Since i will need to remove the above script i assume and configure Netplan with dhcpd4: true for interface enp3s0 to obtain Computer A Internet connection with DHCP request, there must be a way to:

  1. Prevent dnsmasq (A) to respond to requests from its own host (A)
  2. Configure correct IP address on enp3s0 to work in two networks under two different IPs (?)

Why

  • No more ethernet interface on A over than enp3s0.
1

With simple configuration you are trying to realize also router will see all the requests (even it would ignore it - "accepting only A's MAC"). The single NIC not necessary would be an issue... To be honest if you want to really have it working and still separated (A is doing also MASQUERADE) I would think about utilizing VLANs (802.1q) and switch supporting this feature. The cost would not be much higher and even with single NIC on A you can have still separated traffic... One port on switch would be "WAN" VLAN and the rest could be "LAN" VLAN. This way internally works also SOHO routers (this can be visible on e.g. openwrt project side where is shown internal setting of the switch on the routers) ;-).

With 802.1q utilizing you will have two logical NICs available on the system:

  • enp3s0.1 (VLAN 1 @enp3s0)
  • enp3s0.2 (VLAN 2 @enp3s0)

From the following configuration of the system you will handle these logical interface like any other physical network cards so on one you can run DHCP client for connection outside & MASQUERADE and on other you can simply run DHCP server.

Keywords for feature searching: 802.1q, VLAN, traffic separation on the SOHO switch

--- edit (2019-03-21) : update interface id from wlp2s0 to requested enp3s0 ---

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.