huligong1234

使用命令设置ubuntu的ip地址

 

使用命令设置ubuntu的ip地址

1.修改配置文件blacklist.conf禁用IPV6
sudo vi /etc/modprobe.d/blacklist.conf
添加如下:
blacklist ipv6

2.设置IP(设置网卡eth0的IP地址和子网掩码)
sudo ifconfig eth0 192.168.1.1 netmask 255.255.255.0

3.设置网关
sudo route add default gw 192.168.1.1

4.设置DNS(这里使用阿里云DNS http://alidns.com/setup/#linux)
sudo vi /etc/resolv.conf
加入:
nameserver 223.5.5.5
nameserver 223.6.6.6

也可以使用114DNS (http://www.114dns.com/)
114.114.114.114,114.114.115.115
114.114.114.119,114.114.115.119
114.114.114.110,114.114.115.110

或者Google DNS
8.8.8.8和8.8.4.4

5.重启网络服务
sudo /etc/init.d/networking restart


6.查看当前IP
ifconfig

分类:

技术点:

相关文章:

  • 2021-06-27
  • 2021-12-24
  • 2021-06-24
  • 2021-06-17
  • 2021-12-16
  • 2021-12-07
  • 2021-11-04
  • 2021-12-18
猜你喜欢
  • 2021-09-18
  • 2021-09-25
  • 2022-01-01
  • 2022-01-13
  • 2022-12-23
  • 2021-05-14
  • 2022-12-23
相关资源
相似解决方案