网站制作学习网Linux→正文:ubuntu 网卡启动
字体:

ubuntu 网卡启动

Linux 2025/1/17 12:12:59  点击:不统计

原文是网站制作学习网的FoAsP.cn

ubuntu 查看网卡网络相关 
1.查看网卡状态
ip link show
或者
nmcli device status
查看网络状态
ifconfig
 
2. 启动网卡
sudo ip link set <interface_name> up
 
3.设置自动获取ip。 下面的enp5s0 是网卡名称
sudo dhclient enp5s0
 
4. 设置固定IP
 sudo nmcli con mod "Wired connection 1" ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns "8.8.8.8 8.8.4.4"
或者
sudo nano /etc/network/interfaces
内容如下:
auto enp5s0
iface enp5s0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8 8.8.4.4
 
address 设置静态 IP 地址。
netmask 设置子网掩码。
gateway 设置默认网关。
dns-nameservers 设置 DNS 服务器。
 
5. 重启网络服务
sudo systemctl restart networking

原文章%77w%77%2Ef%6F%72%61%73%70%2E%63n

·上一篇:ubuntu保存iptables规则 >>    ·下一篇:linux ubuntu 挂载磁盘 >>
推荐文章
最新文章