Using VirtualBox to springboard VMs to OCI 2 – Let’s All Go to the Cloud

Notice the interface names after the change:

[root@small-ol8 ~]# dmesg | grep -i eth
[ 4.702620] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 08:00:27:8d:0f:64
[ 4.702628] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
[ 5.371103] e1000 0000:00:08.0 eth1: (PCI:33MHz:32-bit) 08:00:27:89:87:98
[ 5.371132] e1000 0000:00:08.0 eth1: Intel(R) PRO/1000 Network Connection
[ 5.373296] e1000 0000:00:08.0 enp0s8: renamed from eth1
[ 5.374971] e1000 0000:00:03.0 enp0s3: renamed from eth0

We’ll need to execute the change on the kernel with the changes shown in the following code block, renaming the interface to match. This will require GRUB(2), as GRUB is the middleman between the kernel and the OS. We have the current interface names now, so where do we go from here? What we’re doing here is renaming the interfaces to reflect a more acceptable name, such as net0 or Eth0. So, we have to move (mv) or rename the interface filenames:

[root@small-ol8 network-scripts]# mv /etc/sysconfig/network-scripts/ifcfg-enp0s3 /etc/sysconfig/network-scripts/ifcfg-net0
[root@small-ol8 network-scripts]# mv /etc/sysconfig/network-scripts/ifcfg-enp0s8 /etc/sysconfig/network-scripts/ifcfg-net1

After we rename the interfaces, we need to change the entries in the configuration files themselves to match the filename. In the following code, we’re renaming the configuration of net0:

[root@small-ol8 network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-net0

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=
enp0s3

#UUID=e9e58f08-3fcc-4a43-b605-797a6bc9998f

DEVICE=
enp0s3

ONBOOT=yes
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=
net0

UUID=e9e58f08-3fcc-4a43-b605-797a6bc9998f

DEVICE=
net0

ONBOOT=yes

We’re doing the same thing here as previously, but in this case, we’re changing net1:

[root@small-ol8 network-scripts]# vi /etc/sysconfig/network-scripts/ifcfg-net1

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=
enp0s8

#UUID=eb2e5ed7-ec13-4f76-a0bf-48e7bcf45e84

DEVICE=
enp0s8

ONBOOT=yes
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME=
net1

#UUID=eb2e5ed7-ec13-4f76-a0bf-48e7bcf45e84

DEVICE=
net1

ONBOOT=yes

In the following code block, we’re using ip a to identify the interfaces and make sure our changes have taken effect:

[root@small-ol8 ~]# ip a

1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
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:
net0
: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:8d:0f:64 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.5/24 brd 10.0.2.255 scope global dynamic noprefixroute net0
valid_lft 459sec preferred_lft 459sec
inet6 fe80::a00:27ff:fe8d:f64/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3:
net1
: mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:89:87:98 brd ff:ff:ff:ff:ff:ff
inet 192.168.56.5/24 brd 192.168.56.255 scope global dynamic noprefixroute net0
valid_lft 85059sec preferred_lft 85059sec
inet6 fe80::a00:27ff:fe89:8798/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: virbr0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:9a:de:c3 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
[root@small-ol8 ~]#

What does GRUB configuration do? It alters the way the OS boots and loads kernels. For example, let’s look at what changing the serial connection details accomplishes. (We’re getting a little off-subject here; however, it’s important to understand how OCI works in worse-case scenarios.) Imagine you can’t reach your server; the network is down, but the server is green and up. You can use a serial connection as a back door. The following console edit instructs the OS to allow an out-of-band connection to the VM:

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=”console”

GRUB_DISABLE_RECOVERY=”true”
GRUB_ENABLE_BLSCFG=true
~
~
~
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL=”serial console”

GRUB_TERMINAL_OUTPUT=”console”
GRUB_CMDLINE_LINUX=”console=tty1 console=ttyS0,115200″

GRUB_DISABLE_RECOVERY=”true”
GRUB_ENABLE_BLSCFG=true
GRUB_SERIAL_COMMAND=”serial –unit=0 –speed=115200″

~
~
~

The following command reloads GRUB. As we can’t edit GRUB directly, we edit it through a configuration file, and use this to execute edits on GRUB. This tells the OS that we’re ready to reload and have entered new data:

[root@small-ol8 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

Since we edited GRUB and made a couple of other OS changes, it’s good to get a fresh start with things:

[root@small-ol8 network-scripts]# reboot