configure_static_ip_address_ubuntu_server_22_04
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
configure_static_ip_address_ubuntu_server_22_04 [2023/06/20 12:09] – wikiadmin | configure_static_ip_address_ubuntu_server_22_04 [2023/06/20 14:42] (current) – wikiadmin | ||
---|---|---|---|
Line 4: | Line 4: | ||
user@svr1: | user@svr1: | ||
eno1: flags=4163< | eno1: flags=4163< | ||
- | inet 192.168.2.106 | + | inet 192.168.1.95 |
inet6 fe80:: | inet6 fe80:: | ||
ether d4: | ether d4: | ||
Line 22: | Line 22: | ||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
- | user@svr1: | ||
- | Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } | ||
- | ip [ -force ] -batch filename | ||
- | where OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link | | ||
- | | ||
- | | ||
- | ntbl | route | rule | sr | tap | tcpmetrics | | ||
- | token | tunnel | tuntap | vrf | xfrm } | ||
- | | ||
- | -h[uman-readable] | -iec | -j[son] | -p[retty] | | ||
- | -f[amily] { inet | inet6 | mpls | bridge | link } | | ||
- | -4 | -6 | -M | -B | -0 | | ||
- | -l[oops] { maximum-addr-flush-attempts } | -br[ief] | | ||
- | -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] | | ||
- | -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] | | ||
- | -c[olor]} | ||
user@svr1: | user@svr1: | ||
user@svr1:/ | user@svr1:/ | ||
Line 45: | Line 29: | ||
user@svr1:/ | user@svr1:/ | ||
eno1: flags=4163< | eno1: flags=4163< | ||
- | inet 192.168.2.106 | + | inet 192.168.1.95 |
inet6 fe80:: | inet6 fe80:: | ||
ether d4: | ether d4: | ||
Line 62: | Line 46: | ||
TX packets 288 bytes 29450 (29.4 KB) | TX packets 288 bytes 29450 (29.4 KB) | ||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
+ | </ | ||
+ | Let's switch to / | ||
+ | |||
+ | < | ||
+ | user@svr1:$ cd / | ||
+ | user@svr1:/ | ||
+ | user@svr1:/ | ||
+ | </ | ||
+ | |||
+ | Then, before we edit the network configuration file, let's make a backup of the ' | ||
+ | |||
+ | < | ||
user@svr1:/ | user@svr1:/ | ||
' | ' | ||
Line 132: | Line 128: | ||
user@svr1:/ | user@svr1:/ | ||
00-installer-config.yaml | 00-installer-config.yaml | ||
+ | </ | ||
+ | |||
+ | After Saving the new static configuration using Vim (:w :qs), then apply the changes to netplan as follows: | ||
+ | |||
+ | < | ||
user@svr1:/ | user@svr1:/ | ||
[sudo] password for user: | [sudo] password for user: | ||
Line 137: | Line 138: | ||
Falling back to a hard restart of systemd-networkd.service | Falling back to a hard restart of systemd-networkd.service | ||
user@svr1:/ | user@svr1:/ | ||
+ | </ | ||
+ | |||
+ | Notice that there was an error (failed to load, then the system auto-performed a hard restart of systemd-neworkd.service). This may be the result of using the first example above rather than the second (containing the line ' | ||
+ | |||
+ | |||
+ | Now test the static configuration by running ping, or whatever else may be useful. | ||
+ | |||
+ | < | ||
user@svr1:/ | user@svr1:/ | ||
PING www.google.com (142.250.217.228) 56(84) bytes of data. | PING www.google.com (142.250.217.228) 56(84) bytes of data. | ||
Line 149: | Line 158: | ||
rtt min/ | rtt min/ | ||
user@svr1:/ | user@svr1:/ | ||
+ | </ | ||
+ | |||
+ | Run ifconfig: | ||
+ | |||
+ | < | ||
+ | $ ifconfig | ||
+ | eno1: flags=4163< | ||
+ | inet 192.168.1.95 | ||
+ | inet6 fe80:: | ||
+ | ether d4: | ||
+ | RX packets 183111 | ||
+ | RX errors 0 dropped 88 overruns 0 frame 0 | ||
+ | TX packets 47132 bytes 8346015 (8.3 MB) | ||
+ | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
+ | device interrupt 16 | ||
+ | |||
+ | lo: flags=73< | ||
+ | inet 127.0.0.1 | ||
+ | inet6 ::1 prefixlen 128 scopeid 0x10< | ||
+ | loop txqueuelen 1000 (Local Loopback) | ||
+ | RX packets 374 bytes 38261 (38.2 KB) | ||
+ | RX errors 0 dropped 0 overruns 0 frame 0 | ||
+ | TX packets 374 bytes 38261 (38.2 KB) | ||
+ | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
</ | </ |
configure_static_ip_address_ubuntu_server_22_04.1687262997.txt.gz · Last modified: 2023/06/20 12:09 by wikiadmin