tutorials:add_network_routes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tutorials:add_network_routes [2022/09/20 14:55] – created tetovjtutorials:add_network_routes [2022/09/29 12:29] (current) – [Windows] tetovj
Line 27: Line 27:
 ==== Windows ==== ==== Windows ====
  
-Use [[tutorials:add_network_routes#subnet-mask|subnet mask]], $SUBNET should be the route with 0 replacing variable parts of the IP. E.g. 192.168.0.0.+Use [[#subnet_mask|subnet mask]], $SUBNET should be the route with 0 replacing variable parts of the IP. E.g. 192.168.X.0.
  
   - Open administrative shell: Press Alt+X and select "Command Prompt (Admin)"/"Windows Powershell (Admin)".   - Open administrative shell: Press Alt+X and select "Command Prompt (Admin)"/"Windows Powershell (Admin)".
Line 34: Line 34:
 ==== Mac ==== ==== Mac ====
  
-Use [[tutorials:add_network_routes#cidr-notation|CIDR notation]].+Use [[#cidr_notation|CIDR notation]].
  
   - Open a terminal   - Open a terminal
Line 41: Line 41:
 ==== Linux ==== ==== Linux ====
  
-Use [[tutorials:add_network_routes#cidr-notation|CIDR notation]].+Use [[#cidr-notation|CIDR notation]].
  
 +=== Temporarily via ip route (Most distros) ===
   - Open a terminal.   - Open a terminal.
-  - Find your preferred device using ''ip link'' (enp* or eth* for ethernet and wlp* or wifi* for wireless). Replace in code below where it  says enpXsY.+  - Find your preferred device using ''ip link'' (enp* or eth* for ethernet and wlp* or wifi* for wireless)
   - Store choosen interface by running ''DEVICE=enpXsY''   - Store choosen interface by running ''DEVICE=enpXsY''
-  - Select from following options: 
- 
-=== Temporarily via ip route (Most distros) === 
  
 ''sudo ip route add $SUBNET via $GATEWAY dev "$DEVICE"'' ''sudo ip route add $SUBNET via $GATEWAY dev "$DEVICE"''
Line 54: Line 52:
 === NetworkManager persistent (Most distros) === === NetworkManager persistent (Most distros) ===
  
-''sudo nmcli connection modify "$DEVICE" +ipv4.routes "$SUBNET $GATEWAY"''+  - Open a terminal. 
 +  - Find your preferred connection using ''nmcli connection show'' (e.g. ''Wired Connection 1'' 
 +  - Store choosen interface by running ''CONNECTION="Wired Connection 1"'' 
 + 
 +''sudo nmcli connection modify "$CONNECTION" +ipv4.routes "$SUBNET $GATEWAY"''
  
 === Netplan persistent route (Ubuntu/cloud init) === === Netplan persistent route (Ubuntu/cloud init) ===
 +
 +  - Open a terminal.
 +  - Find your preferred device using ''ip link'' (enp* or eth* for ethernet and wlp* or wifi* for wireless).
 +  - Replace enpXsY in YAML snippet below with chosen device.
  
 Add the following to ''/etc/netplan/new_route.yaml'' (needs to be edited with sudo, any file name is fine with extension yaml/yml) Add the following to ''/etc/netplan/new_route.yaml'' (needs to be edited with sudo, any file name is fine with extension yaml/yml)
  • tutorials/add_network_routes.1663685737.txt.gz
  • Last modified: 2022/09/20 14:55
  • by tetovj