V
Size: a a a
V
a6
a6
A
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.88.1 0.0.0.0 UG 100 0 0 enx00e06c3836c5
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enx00e06c3836c5
192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 enx00e06c3836c5
$ cat wg0.conf
[Peer]
PublicKey = 1234abcd
Endpoint = vpn-server.com:51820
AllowedIPs = 0.0.0.0/0
[Interface]
PrivateKey = def1234a
Address = 10.8.0.2/32
Table=off
PostUp = bash -c "/etc/wireguard/ip-route-add.sh"
PreDown = bash -c "/etc/wireguard/ip-route-del.sh"
$ cat ip-route-add.sh
#!/bin/bash
ip -4 route add 10.8.0.1/32 dev wg0
ip -4 route add "$(dig +short vpn-server.com)/32" dev $(ip route get 8.8.8.8 | grep 8.8.8.8 | awk '{print $5}')
for IP in $(cat /etc/wireguard/list); do
ip -4 route add $IP dev wg0
done
$ wg-quick up wg0
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.8.0.2/32 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] bash -c "/etc/wireguard/ip-route-add.sh"
A
V
A
$ route -n | grep 10.8.0
10.8.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 wg0
$ route -n | grep 1.2.3.4
1.2.3.4 0.0.0.0 255.255.255.255 UH 0 0 0 enx00e06c3836c5
$ route -n | grep 192.168.88
0.0.0.0 192.168.88.1 0.0.0.0 UG 100 0 0 enx00e06c3836c5
192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 enx00e06c3836c5
A
A
A
V
ВМ
ВМ
MK
[root@nixos:~]# parted -l
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 537MB 536MB fat16 ESP msftdata
2 537MB 34.4GB 33.8GB primary
[root@nixos:~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root vg -wi-ao---- <15.50g
[root@nixos:~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg lvm2 a-- <15.50g 0
A
$ route -n | grep 1.2.3.4
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
1.2.3.4 0.0.0.0 255.255.255.255 UH 0 0 0 enx00e06c3836c5
V
A
$ ip route | grep default
default via 192.168.88.1 dev enx00e06c3836c5 proto dhcp metric 100
AC
V