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
  • 53,069
  • 19
  • 162
  • 212
  • Welcome! This sounds interesting, but what is your question? Is it about how you should go about adding a similar routing instruction you have in Windows via NetworkManager in Arch Linux? Or something else? – Giacomo1968 Sep 11 '15 at 18:18
  • 1
    yes, how I would add routing instructions in linux via networkmanager. –  Sep 11 '15 at 18:19

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.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966