The procedure for configuring a bare metal network depends on the operating system installed on the bare metal server. This section uses a CentOS as an example.
Log in to the bare metal server through SSH.
Execute the following command to identify whether 802.1q has been loaded to the server:
Lsmod |grep 8021q
If 802.1q has not been loaded, execute the /sbin/modprobe –a 8021q command, and then execute the Lsmod |grep 8021q command again.
Execute the following commands to display the NICs on the server:
[root@root~]# cd /etc/sysconfig/network-scripts/
[root@root network-scripts]# ll
For example, if a NIC named ifcfg-eth0 exists on the server, execute the following command to copy the configuration of the NIC, and name it as ifcfg-eth0.{vlan id}, where the VLAN ID can be obtained on the Cloud Services > Network > Classic Networks page.
[root@root network-scripts]# cp ifcfg-eth0 ifcfg-eth0.1725
Edit ifcfg-eth0.1725 to add the following content:
VLAN=yes
DEVICE=eth0.1725
Execute the following command to restart the network service for the configuration to take effect:
[root@root network-scripts]# systemctl restart network.service
If the system prompts an error message, execute the following commands:
systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network.service
Test network connectivity. The configuration succeeds if the network is reachable.