7

I need some help with networking. I know how to do this in Windows, but not in NetworkManager on Arch Linux.

First my setup:

  • NetworkManager
  • Arch Linux

IP Addresses:

+---------------+-----------------+---------------+------------------------------+
| Address:      | Netmask:        | Gateway:      | Range IP is meant to access: |
+---------------+-----------------+---------------+------------------------------+
| 192.168.0.28  | 255.255.255.0   | 192.168.0.1   | Everything except 172.*.*.*  |
+---------------+-----------------+---------------+------------------------------+
| 172.25.73.162 | 255.255.255.248 | 172.25.73.161 |                              |
+---------------+-----------------+---------------+------------------------------+

I know the Windows command is:

route -p ADD 172.16.0.0 MASK 255.240.0.0 172.25.73.161

I need to make all traffic go through 192.168.0.28, and any traffic from or to 172.*.*.* go through 172.25.73.162.

Giacomo1968
  • 58,727

1 Answers1

12

The route translates to 172.16.0.0/12 via 172.25.73.161. So you can configure it in NM like this:

nmcli con modify "connection name" ipv4.routes "172.16.0.0/12 172.25.73.161"

Or use nm-connection-editor – under "IPv4 Settings" / "Routes", add 172.16.0.0 with netmask 255.240.0.0, gateway 172.25.73.161, and the default metric.

To add the route just temporarily, use:

ip route add 172.16.0.0/12 via 172.25.73.161

Also, your requirements contradict themselves.

172.16.0.0 with netmask 255.240.0.0 is not the same thing as "172.*.*.*" – the netmask only covers addresses from 172.16.0.0 to 172.31.255.255.

grawity
  • 501,077