VMWare上配置Linux虚拟机的网卡

时间:2022-12-24 18:53:23


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

配置routeip 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