准备:
Linux版本是CentOS 8.0
Jdk版本1.8 压缩包
hadoop 2.6.5 压缩包
1.查看网卡名称 ifconfig
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.20.100 netmask 255.255.255.0 broadcast 192.168.20.255
inet6 fe80::4aa9:a2d4:3cd5:5d08 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:4b:38:aa txqueuelen 1000 (Ethernet)
RX packets 132312 bytes 190805974 (181.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10645 bytes 875953 (855.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 360 bytes 31296 (30.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 360 bytes 31296 (30.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:66:f3:92 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.编辑网卡
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=static // 设置成静态IP
NAME=ens33
DEVICE=ens33 // 网卡名称 必须和设备名一致
ONBOOT=yes // 系统启动时激活网卡
IPADDR=192.168.20.100 // IP地址 与网关前几位对应
NETMASK=255.255.255.0 // 子网掩码
GATEWAY=192.168