ip网络的设置设置与

ifconfig eth0 172.25.254.100 netmask 255.255.255.0 设定为临时ip

 DHCp动态ip设定

static 静态ip为系统使用者自行设定

 网路设定

常用网络协议ipv4

32 2进制

11111110.11111110.11111110.11111110 == 254.254.254.254

ip  netmask:

用来标示ip的网络位和主机位

网络位表示网络区域

主机位表示网络区域的中的某台主机

netmask非0位置所对应的ip地址数值为这个ip的网络位

netmask 0位所对应的ip地址数值为这个ip的主机位

网络位一致主机位不一致的两个ip是可以

方法一

ifconfig device ip netmask 255.255.250.0

ifconfig eth0 172.25.254.100 netmask 255.255.255.0

这样的设定是临时的,在网络服务重新启动后失效

nmtui        当系统没有图形时可以用此命令开启网络设定的

nm-connection-editor 图形的设定ip的方式

网络设定ip

 ip addr show eth0

systemctl restart network

网络设备设定ip的方式有两种

dhcp 动态获取,ip不固定

static 静态ip为操作者自行设定,ip固定

在此图形中选择dhcp动态网络

在此图形工具中选择manual为静态网络,ip必须自行手动输入

方法3

nmcli   device

nmcli   device   status eth0 无界面显示 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

改变eth0的名字

nmcli  connection add type ethernet con-name westos ifname eth0 autoconnect yes  动态链接ip

nmcli  connection add type ethernet con-name westos ifname eth0 ip4 172.25.254.100/24

例如

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 本机只能一个ip

PREFIX 本机多个ip

vim /etc/hosts

/hosts/ 本地解析网站ip 手动

自己解析地址

vim /etc/resolv.conf

nameservser 114.114.114.114

dns

别人帮解析地址

killall -9 firefox

真机的操作

vim /etc/sysconfig/network-scripts/ifcfg-br0

去除网关

systemctl restart network

重新启动网络服务

连上wifi

route -n 查看本的的网关状态

systemctl start firewlld 重新启动防火墙

firewalld-cmd-list-all 查看 masquerade:yes

firewalld-cmd --add-masquerade

本地让虚拟机联网

systemctl start firewalld 重新启动防火墙

firewall-cmd-add-masquerade

没用的命令

fire-cmd --remove-masquerade

fire-cmd --list-all

真机 ping www.baid.com

firewalld-cmd --list-all ->yes

在虚拟主机中看ip网关 dns

ping 网关

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

猜你喜欢

转载自blog.csdn.net/period000/article/details/79969090
今日推荐