This time, I would like to output how to add a CentOS 7.3 NIC on the ESXi host.
item | Version etc. |
---|---|
HyperVisor | ESXi6.7 |
OS | CentOS7.3 |
[root@tspweb01 ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[root@tspweb01 ~]#
[root@tspweb01 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global mngtmpaddr dynamic
valid_lft 2591907sec preferred_lft 604707sec
inet6 fe80::20c:29ff:feee:2eba/64 scope link
valid_lft forever preferred_lft forever
[root@tspweb01 ~]#
Shut down the OS.
(1) Check the host name and IP address. Is the target correct?
[root@tspweb01 ~]# uname -n;ip a
tspweb01
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global mngtmpaddr dynamic
valid_lft 2591821sec preferred_lft 604621sec
inet6 fe80::20c:29ff:feee:2eba/64 scope link
valid_lft forever preferred_lft forever
[root@tspweb01 ~]#
② OS shutdown
[root@tspweb01 ~]# shutdown -h now
③ Confirm that the power is off
① Right-click the target machine and click "Edit Settings"
② Click "Add Network Adapter"
(3) A new network adapter will be added, so select the target network.
The settings are as follows.
item | Setting |
---|---|
status | □ Connect when power is on |
Adapter type | VMXNET3 |
④ After completing the settings, click "Save".
⑥ Confirm that "Reconfig VM" becomes "normal end".
⑦ Right-click the target machine and click "Power On"
(1) Log in to the terminal with the terminal software and check the host name and IP address.
[root@tspweb01 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global mngtmpaddr dynamic
valid_lft 2591717sec preferred_lft 604517sec
inet6 fe80::20c:29ff:feee:2eba/64 scope link
valid_lft forever preferred_lft forever
3: ens224: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:0c:29:ee:2e:c4 brd ff:ff:ff:ff:ff:ff
[root@tspweb01 ~]#
→ Confirm that "ens224" has been added
(2) Create a network config file
[root@tspweb01 network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-ens224
** [Details] **
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
IPADDR=192.168.0.42
PREFIX=24
GATEWAY=192.168.0.1
After setting, save with "wq".
** [Settings] **
item | Description |
---|---|
TYPE | type |
BOOTPROTO | When using DHCP"dhcp", If you want to set it statically"static"Or"none" |
IPV6INIT | Whether IPv6 setting is implemented |
NAME | NIC name |
HWADDR | MAC address of NIC |
ONBOOT | Whether to boot the NIC when the OS boots |
IPADDR | IP address(Static setting) |
PREFIX | sub-net mask |
GATEWAY | default gateway |
3: ens224: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:0c:29:ee:2e:c4 brd ff:ff:ff:ff:ff:ff
→ The next part of "link / ether"
③ Check if the content is reflected
[root@tspweb01 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens224
TYPE=Ethernet
BOOTPROTO=none
IPV6INIT=no
NAME=ens224
HWADDR=00:0c:29:ee:2e:c4
DEVICE=ens224
ONBOOT=yes
IPADDR=192.168.0.42
PREFIX=24
GATEWAY=192.168.0.1
[root@tspweb01 network-scripts]#
④ OS shutdown
shutdown -h now
(4) Return to the ESXi screen and open Edit VM Settings.
⑤ Enter ☑ in the status of the added network adapter.
⑥ Click "Save".
⑦ Power on the target machine.
⑧ After power-on is completed, log in to the server. After logging in, check the host name and IP address.
[root@tspweb01 ~]# uname -n;ip a
tspweb01
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.0.41/24 brd 192.168.0.255 scope global ens192
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2eba/64 scope global mngtmpaddr dynamic
valid_lft 2591977sec preferred_lft 604777sec
inet6 fe80::20c:29ff:feee:2eba/64 scope link
valid_lft forever preferred_lft forever
3: ens224: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:0c:29:ee:2e:c4 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.42/24 brd 192.168.0.255 scope global ens224
valid_lft forever preferred_lft forever
inet6 2404:7a80:91a1:4d00:20c:29ff:feee:2ec4/64 scope global mngtmpaddr dynamic
valid_lft 2591977sec preferred_lft 604777sec
inet6 fe80::20c:29ff:feee:2ec4/64 scope link
valid_lft forever preferred_lft forever
[root@tspweb01 ~]#
→ Confirm that the IP address set in ens224 is assigned.
⑨ Check if PING communication to the target IP address and SSH login are possible.
About CentOS6 / 7 ifcfg and other configuration files
Recommended Posts