龙空技术网

debian11下网卡ip及dns配置

大智家plus 108

前言:

而今姐妹们对“debian多ip配置”大体比较看重,各位老铁们都想要分析一些“debian多ip配置”的相关文章。那么小编在网上网罗了一些有关“debian多ip配置””的相关文章,希望小伙伴们能喜欢,你们一起来学习一下吧!

切到root下

su - root

root@k8s-master:~# ifconfig

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 192.168.100.8 netmask 255.255.255.0 broadcast 192.168.100.255

inet6 fe80::2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x20<link>

inet6 fd67:bcb8:5ea8:0:2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x0<global>

inet6 2408:8270:446:8610:2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x0<global>

ether 00:a0:98:0b:16:98 txqueuelen 1000 (Ethernet)

RX packets 6122 bytes 861994 (841.7 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 2514 bytes 368874 (360.2 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

发现本地网卡名称为ens3

很多时候会发现debian没法执行ifconfig,那就装一个:

apt install net-tools

vi编辑/etc/network/interfaces,视情况修改及新增如下行,ens3是本地网卡,实际中也可能是其他名称

auto ens3

iface ens3 inet static

address 192.168.100.80

netmask 255.255.255.0

gateway 192.168.100.254

------------------------------------------------------------

vi编辑/etc/resolv.conf.配置dns服务器

nameserver 192.168.100.254

重启网络服务

service networking restart

重新ssh连接,查看ip配置及dns

root@k8s-master:~# ifconfig

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 192.168.100.80 netmask 255.255.255.0 broadcast 192.168.100.255

inet6 fe80::2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x20<link>

inet6 fd67:bcb8:5ea8:0:2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x0<global>

inet6 2408:8270:446:8610:2a0:98ff:fe0b:1698 prefixlen 64 scopeid 0x0<global>

ether 00:a0:98:0b:16:98 txqueuelen 1000 (Ethernet)

RX packets 6170 bytes 870059 (849.6 KiB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 2536 bytes 372648 (363.9 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@k8s-master:~# nslookup

> 163.com

Server: 192.168.100.254

Address: 192.168.100.254#53

Non-authoritative answer:

Name: 163.com

Address: 123.58.180.8

Name: 163.com

Address: 123.58.180.7

> exit

标签: #debian多ip配置 #debian10 ip配置