I have a laptop running debian 9 with a wired NIC and a WIFI NIC. I want to connect the wired NIC to a CCTV network which the DVR has an ip subnet and no gateway. I can add the gateway as I want it to be the laptop. Everything on this network has a static ip address and there is no need for a DHCP server. I use a mobile hotspot on my phone which give the WIFI NIC an IP address of 192.168.43.xxx.

I have tried a few tutorials without any success and as this is just so I can get tech support hooked into the DVR to solve a more pressing issue so it will not be permanent.

I really just want to give the DVR the gateway of the laptop and configure the laptop to route between the 2 NICs so I can get internet connectivity to the DVR.

The laptop has a fresh install. I am unsure what to give the wired NIC on the laptop as a gateway and then how to make the wired NIC network 10.1.18.xxx use the WIFI NIC for internet connectivity so tech support for the DVR can hook into it via either Teamviewer or Remote Desktop.

1 Answer 1


Since there is no gateway on the network segment the wired NIC is connected to, leave the gateway unset on the wired NIC.

(In a system with multiple network connections, only the internet-facing network connection really needs to have the default gateway setting configured.)

The next step is enabling the IP routing master switch. Find this part in /etc/sysctl.conf:

# Uncomment the next line to enable packet forwarding for IPv4

Uncomment the second line and then run sysctl -p as root. Now IP routing is enabled and controlled by iptables rules in the FORWARD chain.

Since the wired network segment uses the private 10.x.x.x IP range and your mobile hotspot gives the laptop another private IP in the 192.168.x.x range, you'll have a double NAT problem. I don't know if TeamViewer can handle it; I think Remote Desktop definitely won't. But if you run TeamViewer on the laptop, from there it should be able to both reach the Internet and have the DVR reachable.

The problem is, the DVR will be able to form outgoing connections to the internet, but an incoming connection would only see the hotspot's internet-facing IP: there is no way for an incoming connection to specify that it wants to go to the laptop behind the hotspot's NAT, and then to the DVR in another network segment.

Since you probably cannot add any routes to the mobile hotspot's configuration, you'll need to NAT the traffic coming from the wired network before letting it out to the wireless network. Assuming that the wired interface is called eno1 and the wireless interface is wlo1:

iptables -w -t nat -A POSTROUTING -s -o wlo1 -j MASQUERADE

Now you can configure the laptop's 10.1.18.xxx address as the DVR's default gateway, and if the DVR has built-in TeamViewer capability, you'll probably also have to copy the DNS nameserver settings from the laptop's /etc/resolv.conf (provided by the hotspot) to the DVR.

You must log in to answer this question.

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