[memo] 設定 Ubuntu 固定 IP/ How to Configure Static IP Address on Ubuntu Server/Desktop

手動改 : sudo ifconfig eth0 192.168.0.1 netmask 255.255.255.0

在 /etc/netplan/00-installer-config.yaml
用 DHCP 取 IP

# more 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s3:
      dhcp4: true
  version: 2

增加 /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      addresses:
        - 192.168.100.33/24
      gateway4: 192.168.100.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

需 rm /etc/netplan/00-installer-config.yaml
免得跟原來的config衝突,
再執行

sudo netplan apply

 


OVH:

Some sample …

for office lan

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: no
      addresses:
        - 192.168.1.11/24
      gateway4: 192.168.1.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

[docker] 用 docker 建立 ipsec vpn server


URL: https://github.com/hwdsl2/docker-ipsec-vpn-server

#
docker run \
    --name ipsec-vpn-server \
    --env-file ./vpn.env \
    --restart=always \
    -p 500:500/udp \
    -p 4500:4500/udp \
    -v /lib/modules:/lib/modules:ro \
    -d --privileged \
    hwdsl2/ipsec-vpn-server
#
# docker logs ipsec-vpn-server
# docker exec -it ipsec-vpn-server ipsec status
# docker exec -it ipsec-vpn-server ipsec whack --trafficstatus