With a server that connects to the Internet Separate servers that cannot be connected to the Internet. I don't know what kind of attack will come when I connect to the Internet. Therefore, if you want to prevent the server containing important data from being directly connected to the Internet.
What is a NIC? Network interface card Connect NIC1 to the interface Connect NIC2 to LAN
Create a server. Assign a global IP to the NIC when it is created. After creating the server instance, add a NIC and connect to the switch. The switch address is 192.168.101.1 and the VPN router has been set. Then connect to the VPN with a MacBook Pro etc. and log in to the Ubuntu server.
This time I recorded the procedure to add a NIC and set the local IP address 192.168.101.20.
Execute the command. ip addr To check the address allocation status
ipconfig -a Then, make sure that the eth1 device exists.
netplan It seems that the network is set up from Ubuntu 18 with something called netplan. See below for details. https://wiki.ubuntu.com/Netplan https://netplan.io/
sudo cp -p /etc/netplan/01-netcfg.yaml /home/ubuntu/01-netcfg.yaml.bkup
If you make a mistake in the network settings, you will not be able to log in with SSH. Make a backup so that you can restore it. Hmm? How do I get the settings back when I can't log in with SSH? At that time, let's work using Sakura's cloud console. https://manual.sakura.ad.jp/cloud/server/console.html
sudo vi /etc/netplan/01-netcfg.yaml And edit with the vi editor. You can also use the nano editor.
01-netcfg.yaml after change
network:
ethernets:
eth0:
addresses:
- 153.125.512.30/24
dhcp4: 'no'
dhcp6: 'no'
gateway4: 153.125.512.1
nameservers:
addresses:
- 133.242.0.3
- 133.242.0.4
search:
- localdomain
eth1:
addresses:
- 192.168.101.20/24
renderer: networkd
version: 2
The part to be added below.
eth1:
addresses:
- 192.168.101.20/24
sudo netplan apply To check if the address is reflected in ifconfig.
sudo shutdown -r now Reboot with, log in with SSH and make sure the network settings are enabled with ifconfig. If you make a mistake at this time, you may not be able to log in with SSH. In that case, use the console to restore the settings.
This is the first time I learned about netplan. I'm not familiar with it, so it may be wrong. Masakari is welcome.
Recommended Posts