返回首页

路由器/etc/hosts怎么进?

170 2024-01-19 01:40 admin

1.首先在Linux系统下设置静态的IP地址vim /etc/network/interfaces #编辑网网卡配置文件auto loiface lo inet loopbackauto eth0 #开机自动连接网络iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ipaddress 192.168.21.168 #设置ip地址netmask 255.255.255.0 #设置子网掩码gateway 192.168.21.2 #设置网关ctrl+o #保存配置ctrl+x #退出2.在/etc/profile 加入脚本vim /etc/profilegrep -v "hostname(指定的域名)" /etc/hosts > ~/hosts_temp cat ~/hosts_temp > /etc/hosts LC_ALL=C ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' |cut -d: -f2 | awk '{ print $1}' >> /etc/hosts3.重启网络使设置生效/etc/init.d/networking restart #重启网络

顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片

网站地图 (共14个专题41095篇文章)

返回首页