admin 管理员组文章数量: 1132214
ubuntu20.04子系统设置静态IP
命令行设置:
例如: sudo ifconfig eth0 172.20.20.10 netmask 255.255.255.0
注意: 因为这个是Win10子系统,与WSL有关系,Linux部署不一样
172.20.20.10:自定义的ip地址(需要和自己的(WSL2)网关统一网段)
255.255.255.0:子网掩码 (可以查看WSL的:vEthernet (WSL2):)
eth0: 网卡信息,后边数字0
sudo ifconfig eth0 down //如果eth0是激活的,就把它down掉。此命令等同于 ifdown eth0
sudo ifconfig eth0 ip地址 broadcast 广播地址 netmask 子网掩码
sudo ifconfig eth0 up //激活eth0 ; 此命令等同于 ifup eth0
ifconfig eth0 //查看 eth0的状态
查看是否设置成功,命令:ifconfig (如下即成功)
V:/$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.20.20.10 netmask 255.255.255.0 broadcast 172.20.20.255
inet6 fe80::215:5dff:fec1:5b49 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:c1:5b:49 txqueuelen 1000 (Ethernet)
RX packets 616 bytes 69042 (69.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16 bytes 1216 (1.2 KB)
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 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
ubuntu20@DESKTOP-B3J2A3V:/usr/local/src$ ping 172.20.20.10
PING 172.20.20.10 (172.20.20.10) 56(84) bytes of data.
64 bytes from 172.20.20.10: icmp_seq=1 ttl=64 time=0.023 ms
64 bytes from 172.20.20.10: icmp_seq=2 ttl=64 time=0.037 ms
64 bytes from 172.20.20.10: icmp_seq=3 ttl=64 time=0.033 ms
启动Redis连接如下图:
备忘下,其他详细可以自己再百度!
这些文章不错,可以看看,讲的笔记详细:
Ubuntu中设置静态IP的方法介绍–脚本之家
ubuntu设置静态IP后上不了网
ubuntu20.04 server 版设置静态 IP 地址
版权声明:本文标题:Win10子系统ubuntu20.04设置静态ip、笔记 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.520sys.cn/xp/1763699661a1699728.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论