ifconfig eth0 172.25.254.100 netmask 255.255.255.0 set as temporary ip
DHCP dynamic ip setting
static static ip for system users to set by themselves
network settings
Common network protocol ipv4
32 binary
11111110.11111110.11111110.11111110 == 254.254.254.254
ip netmask:
Network bit and host bit used to indicate ip
Network bits represent the network area
The host bit represents a host in the network zone
The ip address value corresponding to the non-zero position of netmask is the network bit of this ip
The ip address value corresponding to the 0 bit of netmask is the host bit of this ip
The network bit is consistent, and the two IPs with inconsistent host bits are OK.
method one
ifconfig device ip netmask 255.255.250.0
ifconfig eth0 172.25.254.100 netmask 255.255.255.0
Such settings are temporary and will expire after the network service is restarted
nmtui When the system has no graphics, you can use this command to open the network settings
nm-connection-editor Graphical way of setting ip
network setting ip
ip addr show eth0
systemctl restart network
There are two ways to set the IP of a network device
dhcp dynamic acquisition, ip is not fixed
static static ip is set by the operator, the ip is fixed
select dhcp dynamic network in this graphic
In this graphical tool, select manual as static network, ip must be manually entered by yourself
Method 3
nmcli device
nmcli device status eth0 No interface displays the network status of eth0
nmcli device show eth0
nmcli device disconnect eth0
nmcli device connect eth0
nmcli connection
nmcli connection down westos
nmcli connection up westos
nmcli connection show westos
nmcli connection delete westos
Change the name of eth0
nmcli connection add type ethernet con-name westos ifname eth0 autoconnect yes dynamic link ip
nmcli connection add type ethernet con-name westos ifname eth0 ip4 172.25.254.100/24
E.g
nmcli connection modify ethernet-eth0 ipv4.adress 172.25.254.100
nmcli connection modify ethernet-eth0 ipv4.method manual
nmcli connection modify ethernet-eth0 ipv4.method auto
systemctl restart network
dhcp-- static
nmcli connection modify westos ipv4.addresses 172.25.254.100/24
netmask This machine can only have one ip
PREFIX local multiple ip
vim /etc/hosts
/hosts/ local resolution website ip manual
resolve the address yourself
vim /etc/resolv.conf
nameservser 114.114.114.114
dns
Others help resolve the address
killall -9 firefox
real machine operation
vim /etc/sysconfig/network-scripts/ifcfg-br0
remove gateway
systemctl restart network
restart network service
connect to wifi
route -n View the gateway status of this
systemctl start firewlld restarts the firewall
firewalld-cmd-list-all View masquerade: yes
firewalld-cmd --add-masquerade
Network the virtual machine locally
systemctl start firewalld restarts the firewall
firewall-cmd-add-masquerade
useless command
fire-cmd --remove-masquerade
fire-cmd --list-all
Real machine ping www.baid.com
firewalld-cmd --list-all ->yes
see ip gateway dns in virtual host
ping gateway
vim /etc/sysctl.conf
ip_forward = 1
syscrl -p
route del default
generated by networkmanager
search ilt.example.com.exanple.com
nameserver 192.168.43.1
172.25.254.250