vm1是host only专用的,VM8是NAT模式
host only:Win7和Linux必须同一个网段,用vm1网卡,不能上网。。
网关设置和Win7上vm1网卡ipv4的IP一样
bridge:Win7和Linux不用同一个网段,可以上网。。
如果上不了网,是没设置DNS。。
命令行修改IP、配置网卡:
cd /etc/sysconfig/network-scripts
vim /etc/sysconfig/network-scripts/ifcfg-eth0
修改主机名:
vim /etc/sysconfig/network
重启服务器生效:reboot -h now
docker重启的会更快
IP与主机名绑定:
vim /etc/hosts
一次关闭:
service iptables stop
永久关闭:
chkconfig iptables off
查看防火墙状态:
chkconfig --list iptables
SSH配置:
ssh-ketgen -t rsa
cat /root/.ssh.id_rsa.pub >> /root/.ssh/authorized_keys
ssh-copy-id -i hadoop1
//显示主机名信息
[root@i-love-you hadoop]# more /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=i-love-you
GATEWAY=192.168.1.1
//显示IP、网络等信息,另显示网卡ifcfg-eth0信息
[root@i-love-you hadoop]# ls /etc/sysconfig/network-scripts
ifcfg-eth0 ifdown-eth ifdown-post ifdown-tunnel ifup-eth ifup-plip ifup-routes init.ipv6-global
ifcfg-lo ifdown-ippp ifdown-ppp ifup ifup-ippp ifup-plusb ifup-sit net.hotplug
ifdown ifdown-ipv6 ifdown-routes ifup-aliases ifup-ipv6 ifup-post ifup-tunnel network-functions
ifdown-bnep ifdown-isdn ifdown-sit ifup-bnep ifup-isdn ifup-ppp ifup-wireless network-functions-ipv6
[root@i-love-you hadoop]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=d74138d2-7c9e-4377-a1ad-facffd260fdd
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:0C:29:90:F1:D8
IPADDR=192.168.1.10
PREFIX=24
GATEWAY=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
[root@i-love-you hadoop]#