Set a fixed IP for the CentOS 8 virtual machine created in Hyper-V Connect to virtual machine with Tera Term
● Check the status with a command
# ip a # ip a show dev eth0
eth0: inet 192.168.10.4/24
This will give you the current private IP address. Network address "192.168.10" Host address "4"
● Edit the interface setting file as follows.
IPV6INIT="no" #IPV6_AUTOCONF="yes" #IPV6_DEFROUTE="yes" #IPV6_FAILURE_FATAL="no" #IPV6_ADDR_GEN_MODE="stable-privacy" BOOTPROTO="none" IPADDR=192.168.10.100 PREFIX=24 GATEWAY=192.168.10.1 DNS1=192.168.10.1 DNS2=126.96.36.199
I don't use IPV6, so I changed IPV6INIT from "yes" to "no". Other parameters related to IPV6 have been excluded.
・ BOOTPROTO: IP address specification method [none / dhcp / bootp] If you want to specify a fixed IP, you can use "none" or "static".
・ IPADDR: IP address to specify Add an appropriate host address to the previous network address.
・ PREFIX: Prefix length Maybe this is NETMASK or either parameter? maybe. .. ..
・ GATEWAY: Router IP
・ DNS "188.8.131.52" is Google Public DNS
● After setting, restart the network
# systemctl restart NetworkManager
When you check the status ... eth0: inet 192.168.10.100/24
Even if I checked after restarting in the previous procedure, inet6 was set. There may be no problem, but I didn't intend to use it in the settings, so I will disable it.
● Create the following files
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
# sysctl -p/etc/sysctl.d/disable_ipv6.conf
When I checked the status, inet6 disappeared.
● Enter the set IP address
● Connect after entering the user and password
I was able to connect. For the time being, let's assume that you have done what you want to do.