哪位能告诉我路由器修改hosts怎么做?
答案:3 悬赏:50
解决时间 2021-10-13 09:30
- 提问者网友:萌卜娃娃
- 2021-10-12 22:26
哪位能告诉我路由器修改hosts怎么做?
最佳答案
- 二级知识专家网友:玩世
- 2021-10-13 00:01
路由器修改hosts方法:
1.首先在Linux系统下设置静态的IP地址
vim /etc/network/interfaces #编辑网网卡配置文件
auto lo
iface lo inet loopback
auto eth0 #开机自动连接网络
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 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/hosts
3.重启网络使设置生效
1.首先在Linux系统下设置静态的IP地址
vim /etc/network/interfaces #编辑网网卡配置文件
auto lo
iface lo inet loopback
auto eth0 #开机自动连接网络
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 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/hosts
3.重启网络使设置生效
全部回答
- 1楼网友:胯下狙击手
- 2021-10-13 02:26
修改hosts文件,首先要知道hosts文件位置在哪里,最初hosts内容是什么,hosts的作用是干什么; windows xp/2003/vista/2008/7/8系统hosts文件是在“c:\\windows\\system32\\drivers\\etc“目录下hosts文件,不带任何后缀名; hosts文件是用于域名解析,它的优先级大于dns域名解析服务器;这也是它容易被不法分子修改劫持你的域名,你看似访问的是想要的网站,其实已经是另一个钓鱼站点; 默认的hosts文件,一般除了注释说明,就一条本地解析”127.0.0.1 localhost“。
- 2楼网友:孤独入客枕
- 2021-10-13 01:33
1.首先在Linux系统下设置静态的IP地址
vim /etc/network/interfaces #编辑网网卡配置文件
auto lo
iface lo inet loopback
auto eth0 #开机自动连接网络
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 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/hosts
3.重启网络使设置生效
/etc/init.d/networking restart #重启网络
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯