ubuntu 静态ip设置

来源:互联网 发布:淘宝超级运动会优惠 编辑:程序博客网 时间:2024/05/16 07:36

两种方法:

1.直接命令行设置,但是重启后失效

设置IP 和 子网掩码sudo ifconfig eth1 211.87.235.204 netmask 255.255.255.0设置网关sudo route add default gw 211.87.235.1

2.在 debian 默认配置文件里修改

/etc/network/interfaces设置 ip 掩码 网关#开机自动激活 eth0auto eth0#iface eth0 inet dhcpiface eth0 inet static    address 211.87.235.204    netmask 255.255.255.0    gateway 211.87.235.1/etc/resolv.conf设置 DNS 服务器 (网关地址)# Generated by NetworkManagernameserver 211.87.235.1nameserver 202.194.15.12最后 reboot 或者 /etc/init.d/networking restart

3.实验室一般网络设置都是 用dhcp服务 动态设置 ip

#开机自动激活 eth0auto eth0#配置eth0 为dhcp 自动获取iface eth0 inet dhcp# 开机自动激lo接口auto lo# 配置lo接口为环回口iface lo inet loopback这里写代码片
0 0
原创粉丝点击