linux ip
网络图形化ip设置
命令行ip设置
路由器设置
- 一般路由器后有重启按钮,在长按几秒之后,就能完成重启。
- 在路由器“wan”口插入外网网线,将“lan”口和电脑用网线连接起来。
- 参考查看wan口ip地址操作方法,或在浏览器输入路由器后提供的控制地址(或设置的网关的地址)进行设置
电脑端设置
ip设置
- 查看网络配置
ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 # 网卡名eth0,我的地址居然是ipv6的
ether 18:**:**:**:**:** txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 470030 bytes 112744189 (107.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 470030 bytes 112744189 (107.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet ***.26.42.33 netmask 255.255.128.0 broadcast 172.26.127.255
inet6 2001:da8:205:6011:f82a:37e4:641d:4d1c prefixlen 64 scopeid 0x0<global>
inet6 fe80::9068:2efc:9c66:5232 prefixlen 64 scopeid 0x20<link>
ether d4:6a:6a:08:27:f3 txqueuelen 1000 (Ethernet)
RX packets 79500147 bytes 66121252218 (61.5 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 17957104 bytes 2850103581 (2.6 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
- 在/etc/netplan/01-netcfg.yaml文件中编辑
network:
version: 2
renderer: networkd
ethernets:
wangkamingcheng1:
dhcp4: true
wangkamingcheng2:
addresses: [192.168.5.3/24]
nameservers:
addresses: [114.114.114.114]
- 应用命令 sudo netplan apply
- pc的ip变成169.254.x.x的过程分析
路由设置
- linux查看路由
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.26.0.1 0.0.0.0 UG 600 0 0 wlan0
172.26.0.0 0.0.0.0 255.255.128.0 U 600 0 0 wlan0
- 增加路由
route add -net 192.168.1.0/24 gw 192.168.124.254
- 删除路由
route del -net 192.168.1.0/24 gw 192.168.124.254
有关含义的说明,参卡这两篇文章: - 路由
- 网关
更多可能相关的
-
ubuntu20.04总是弹出“Activation Network connection error”错误_老吕丶的博客-CSDN博客
-
BUG:解决执行firewall-cmd 命令后centos出现activation of network connection fail问题_哥斯拉不会说话的博客
-
使用 NetworkManager 随机化你的 MAC 地址 https://mbd.baidu.com/ma/s/Ih0iie5m
-
FRP内网穿透实践教程https://mbd.baidu.com/ma/s/qu2wjFSh
-
子网掩码与网络划分 https://blog.csdn.net/storyteller321/article/details/80489994