您现在的位置是: 网站首页 >服务部署 服务部署
Debian9修改默认的网卡名称为eth0
admin2018年10月25日 14:55 【Linux 】 1810人已围观
# Debian9修改网卡为eth0 ```bash root@Samba96-21:/home/user# vim.tiny /etc/default/grub ``` ## 修改GRUB_CMDLINE_LINUX ```bash #GRUB_CMDLINE_LINUX="" GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" ``` ## 重新生成grub引导配置文件 ```bash root@Samba96-21:/home/user# grub-mkconfig -o /boot/grub/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.9.0-4-amd64 Found initrd image: /boot/initrd.img-4.9.0-4-amd64 done ``` ## 重启系统启动网卡 ```bash ifup eth0 ``` ## 配置IP地址 ```bash root@Samba96-21:/home/user# vim.tiny /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface # old:enp0s25 allow-hotplug eth0 iface eth0 inet static address 192.168.96.21/24 gateway 192.168.96.1 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 192.168.99.99 dns-search 21 DNS服务器: root@Samba96-21:/home/user# vim.tiny /etc/resolv.conf search 21 nameserver 192.168.99.99 ``` ## 查看IP ```bash root@Samba96-21:/home/user# ip -V ip utility, iproute2-ss161212 root@Samba96-21:/home/user# ip address 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:21:9b:19:38:ad brd ff:ff:ff:ff:ff:ff inet 192.168.96.21/24 brd 192.168.96.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::221:9bff:fe19:38ad/64 scope link valid_lft forever preferred_lft forever ```
很赞哦! (5)
相关文章
文章交流
- emoji