redhatlinux中设置网卡固定ip
之前在xwindow下的redhat-config-network设置网卡固定ip发现不起作用,设置好后就是ping不通。就查了些资料,更改/etc/sysconfig/network-scripts/ifcfg-eth0(第一个网卡为eth0),配置dns的文件为/etc/resolv.conf,我保留了dhcp的配置,配置完后用ifconfigeth0down;ifconfigeth0up就可以了。以下是配置文件的清单:
#/etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.10
NETMASK=255.255.255.0
NETWORK=192.168.1.0
HWADDR=52:54:AB:2F:CF:F0
GATEWAY=192.168.1.1
ONBOOT=on
TYPE=Ethernet
#/etc/resolv.conf
nameserver202.109.14.5
nameserver202.96.209.5
searchlocaldomain
或者使用命令:setup
或者:
routeadd-net192.168.1.50netmask255.255.255.0deveth0
或:
ifconfigeth0192.168.1.50netmask255.255.255.0
ubuntu网卡设置,ip,mask,gateway,dns
sudovi/etc/network/interfaces
//这个应该是决定是否启用这个端口
autoeth0
//静态设置IP
ifaceeth0inetstatic
address172.16.146.200
netmask255.255.255.0
#broadcast172.16.146.255
gateway172.16.146.254
//通过dhcp动态设置
ifaceeth0inetdhcp
//设置DNS服务器
sudovi/etc/resolv.conf
nameserver202.96.128.68
nameserver61.144.56.101
nameserver192.168.8.220
//重新设置网络,以启用新设置
sudo/etc/init.d/networkingrestart
//ok
Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡Redhat与ubuntu配置网卡
阅读(880) | 评论(0) | 转发(0) |