I have several servers on a private network, each with a private IP address assigned and a public IP assigned. I want the servers to only communicate with each other using their private IP addresses.

I have set up the IP addresses using Netplan, but am now trying to set up the routes so that if Server A is trying to communicate with Server B it does so via Server A's private ip, not through any other IP assigned to the server.

This is my Netplan configuration file so far (I've XXX'd out parts of the public IP addresses for security):

      - 217.147.XXX.43/26
      dhcp4: false
      #gateway4: 217.147.XXX.1
        search: []
      - to:
        via: 217.147.XXX.1
        metric: 100
      - to:
        metric: 101
  version: 2

The output of ip route command:

$ ip route
default via 217.147.XXX.1 dev ens160 proto static metric 100 dev ens160 proto kernel scope link src via dev ens160 proto static metric 101 
217.147.XXX.0/26 dev ens160 proto kernel scope link src 217.147.XXX.43 

Output of the ifconfig command:

$ ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 217.147.XXX.43  netmask  broadcast 217.147.XXX.63
        inet6 fe80::2cc:29cc:fef5:966f  prefixlen 64  scopeid 0x20<link>
        ether 00:cc:29:cc:96:6f  txqueuelen 1000  (Ethernet)
        RX packets 728  bytes 71057 (71.0 KB)
        RX errors 0  dropped 119  overruns 0  frame 0
        TX packets 355  bytes 58475 (58.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 102  bytes 8213 (8.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 102  bytes 8213 (8.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The problem that I have is that private network is not visible.

$ ping
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable
. . .

the server 172.XXX.XXX.155 is available from other servers in private network.

Any help would be greatly appreciated. I'm fairly new to networking and Netplan and I'm struggling with the official documentation.

  • By obfuscating all of the IP addresses with XXX, it is impossible to tell which numbers are the same or different in your config, and therefore impossible to notice any errors in the routing config. Please update your question to de-obfuscate the private IPs (they are private, so this doesn't give anyone any sensitive information that could be used in an attack against you). – slangasek Feb 11 at 2:30
  • @slangasek You are right, I've udated the post. – LONGMAN Feb 11 at 10:26
  - to:
    metric: 101

This is incorrect. is your local network, and you are trying to route all traffic for it via That machine is probably not configured to route traffic both to and from 172.17.1..0 on the same interface. If you drop this route, traffic to will be routed via your local network instead, which should work.

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.