【ubuntu】配置固定ip

参考:https://jingyan.baidu.com/article/e5c39bf5bbe0e739d7603396.html

1,终端 ifconfig确定网卡名称,一般为eth0

2,root用户登录

3,vim /etc/network/interfaces

auto eth0

iface eth0 inet static

address 192.168.2.121

netmask 255.255.255.0

gateway 192.168.2.1


##其中address,netmask,gateway分别和ifconfig中eth0中的addr,mask,bcast相对应

4,vim /etc/resolv.conf

添加:

nameserver 192.168.2.1

nameserver 220.170.64.68(百度输入ip直接会显示外网ip)

5,vim /etc/resolvconf/resolv.conf.d/base

添加:

nameserver 192.168.2.1

nameserver 220.170.64.68


6,sudo service network-manager restart

或者:sudo /etc/init.d/networking restart



7,配置ssh及端口

http://blog.csdn.net/zht666/article/details/9340633


**********手动固定ip配置***********

http://service.tp-link.com.cn/detail_article_1418.html






注:此处设置的地址,子网掩码等和上面的相同。


发布了46 篇原创文章 · 获赞 14 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/xll_bit/article/details/78306112