Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| linux:debian:static-ip-address-route [2024/12/27 14:56] – removed - external edit (Unknown date) 127.0.0.1 | linux:debian:static-ip-address-route [2024/12/27 22:22] (current) – [Static route] Zyzonix | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== Set Static IP Address / Static route ===== | ||
| + | ==== ifupdown2 ==== | ||
| + | |||
| + | First install the '' | ||
| + | <code bash> | ||
| + | It will generate the file ''/ | ||
| + | |||
| + | Then edit ''/ | ||
| + | <code bash> | ||
| + | auto eth0 | ||
| + | iface eth0 inet static | ||
| + | address 172.16.1.20/ | ||
| + | gateway 172.16.1.1 | ||
| + | nameserver 172.16.1.1 | ||
| + | </ | ||
| + | Adjust the interface name, here '' | ||
| + | |||
| + | Finally enable the interface by running: | ||
| + | <code bash> | ||
| + | |||
| + | //Sourced from [[https:// | ||
| + | |||
| + | ==== Static route ==== | ||
| + | To show static routes: | ||
| + | <code bash>ip route</ | ||
| + | |||
| + | To add a static route run: | ||
| + | <code bash>ip route add < | ||
| + | Example: | ||
| + | '' | ||
| + | |||
| + | |||
| + | ==== Static route for LXC ==== | ||
| + | |||
| + | To add a persistent static route for a Linux Container add the following line to the interface that should automatically add the route in ''/ | ||
| + | |||
| + | <code bash> | ||
| + | up route add -net < | ||
| + | </ | ||
| + | Example: | ||
| + | '' | ||
| + | |||
| + | //→ tested with a Proxmox CT// | ||
| + | |||
| + | |||
| + | //Sourced from [[https:// | ||