天天看點

VMWare上配置Linux虛拟機的網卡



CentOS6.5:

eth0:/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"

BOOTPROTO="static"

IPADDR="172.31.100.XXX"

NETMASK="255.255.255.0"

GATEWAY="172.31.100.1"

ONBOOT="yes"

DNS1="XXX.XXX.XXX.XXX"

DNS2="XXX.XXX.XXX.XXX"

檢視:ifconfig

Redhat 7:

預設網卡名稱叫ifcfg-eno16777736

修改方法:

  1. 編輯/etc/sysconfig/network-scripts/ifcfg-eno16777736
将NAME屬性修改為eth0
  1. Mv ifcfg-16777736 ifcfg-eth0
  2. 編輯/etc/default/grub,在GRUB_CMDLINE_LINUX參數的值的最後添加net.ifnames=0 biosdevname=0
  3. 執行grub2-mkconfig -o /boot/grub2/grub.cfg來重新生成grub配置并更新核心參數
  4. 重新開機

eth0:/etc/sysconfig/network-scripts/ifcfg-eth0

TYPE="Ethernet"

BOOTPROTO="static"

IPADDR="172.31.100.XXX"

NETMASK="255.255.255.0"

GATEWAY="172.31.100.1"

NAME="eth0"

DEVICE="eth0"

ONBOOT="yes"

USERCTL="no"

DNS1="XXX.XXX.XXX.XXX"

DNS2="XXX.XXX.XXX.XXX"

檢視:ip addr

配置route:ip route [options]

Kali(Debian):

eth0(interface):/etc/network/interfaces

檢視:ifconfig

iface lo inet loopback

auto eth0

iface eth0 inet static

address 172.31.100.XXX

netmask 255.255.255.0

gateway 172.31.100.1

DNS:/etc/resolv.conf

nameserverXXX.XXX.XXX.XXX

nameserverXXX.XXX.XXX.XXX

SUSE 11:

eth0:/etc/sysconfig/network/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

STARTMODE=auto

BOOTPROTO=static

IPADDR=172.31.100.XXX

NETMASK=255.255.255.0

BROADCAST=172.31.100.255

GATEWAY=172.31.100.1

default gateway(route):/etc/sysconfig/network/routes

Default 172.31.100.1 255.255.255.0 eth0

DNS:/etc/resolv.conf

nameserverXXX.XXX.XXX.XXX

nameserverXXX.XXX.XXX.XXX

Ubuntu14.04

eth0:/etc/network/interfaces

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address 172.31.100.XXX

netmask 255.255.255.0

network 172.31.100.0

broadcast 172.31.100.255

gateway 172.31.100.1

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers XXX.XXX.XXX.XXX

繼續閱讀