This thread is a continuation for https://phcorner.net/threads/626556/
At this point, meron na kayong working VM with CentOS 7 as our Development environment. Let us connect your CentOS 7 to the internet then.
You may refer to these screenshots below:
Turn on your Virtual Machine, then login as root.
From here, go to the directory as shown below:
Let us backup our ifcfg-enp0s3 file first, by running:
If you wish to see your back up file, run:
This should list files on our current directory as shown below:
Now, we have our back up file, let us edit ifcfg-enp0s3 by:
Then update these lines below:
Then add this line below:
IPADDR represents your desired IP for your Virtual Machine. Here in my end, I use 192.168.2.100. In my case, I have these details in ifcfg-enp0s3 file below:
Press ctr + c, the type :wq to save these changes.
Now, let us set up our gateway by going to sysconfig directory. To do so, run:
Then, let us make a backup copy of our network file, by:
If you wish to see your backup file, run:
You should have these output below:
Let us now add lines to network work file by:
You should have an empty file. Let us add these lines below:
You should have this output below:
Make sure to press ctr + c, the type :wq to save your changes.
If you have challenges where to get your Default Gateway, you may open your cmd on your Windows host machine, then type:
Look for Default Gateway under your network adapter. In my case, I was using my Wireless Adapter. You should have these output below:
All set? Let us work with our nameservers in resolv.conf file found in etc directory. To go about this, run:
From here, make a backup copy of your resolv.conf file first, by:
You can view these changes by:
At this point, we should be able to add lines on our resolv.conf file. To do so, run:
This should let us edit our file using vi. For starters, vi is a Command Line Editor. If you wish to know more about vi, Ryan Chadwick made a simple explanation of how it works, see his work You do not have permission to view the full content of this post. Log in or register now.
From here, add these links below:
These are You do not have permission to view the full content of this post. Log in or register now., and we will use them as our DNS resolver.
Make sure to press ctr + c, the type :wq to save these changes.
We are almost done. Make sure to restart our network changes by running:
Once completed, run :
You should see your IP address as shown below:
One way to test if you have an internet connection is to ping a site. In our case, I will ping google.com
Press ctrl + c to stop the command.
At this point, you should have a working CentOS 7 with an internet connection. Well done.
Next thread, let us install an SSH in CentOS 7 Minimal Server.
At this point, meron na kayong working VM with CentOS 7 as our Development environment. Let us connect your CentOS 7 to the internet then.
You may refer to these screenshots below:
Turn on your Virtual Machine, then login as root.
From here, go to the directory as shown below:
Code:
cd /etc/sysconfig/network-scripts/
Let us backup our ifcfg-enp0s3 file first, by running:
Code:
cp ifcfg-enp0s3 ifcfg-enp0s3_backup
If you wish to see your back up file, run:
Code:
ls -lah | less
This should list files on our current directory as shown below:
Now, we have our back up file, let us edit ifcfg-enp0s3 by:
Code:
vi ifcfg-enp0s3
Then update these lines below:
Code:
BOOTPROTO=static
ONBOOT=yes
Then add this line below:
Code:
IPADDR=192.168.2.100
IPADDR represents your desired IP for your Virtual Machine. Here in my end, I use 192.168.2.100. In my case, I have these details in ifcfg-enp0s3 file below:
Press ctr + c, the type :wq to save these changes.
Now, let us set up our gateway by going to sysconfig directory. To do so, run:
Code:
cd /etc/sysconfig
Then, let us make a backup copy of our network file, by:
Code:
cp network network_backup
If you wish to see your backup file, run:
Code:
ls -lah | grep net
You should have these output below:
Code:
https://tutorials-images.kurtobando.com/2018/09/image-42.png
Let us now add lines to network work file by:
Code:
vi network
You should have an empty file. Let us add these lines below:
Code:
NETWORKING=yes
HOSTNAME=centos7
GATEWAY=192.168.2.1
You should have this output below:
Make sure to press ctr + c, the type :wq to save your changes.
If you have challenges where to get your Default Gateway, you may open your cmd on your Windows host machine, then type:
Code:
ipconfig
Look for Default Gateway under your network adapter. In my case, I was using my Wireless Adapter. You should have these output below:
All set? Let us work with our nameservers in resolv.conf file found in etc directory. To go about this, run:
Code:
cd /etc/
From here, make a backup copy of your resolv.conf file first, by:
Code:
cp resolv.conf resolv.conf_backup
You can view these changes by:
Code:
ls -lah | grep resv
At this point, we should be able to add lines on our resolv.conf file. To do so, run:
Code:
vi resolv.conf
This should let us edit our file using vi. For starters, vi is a Command Line Editor. If you wish to know more about vi, Ryan Chadwick made a simple explanation of how it works, see his work You do not have permission to view the full content of this post. Log in or register now.
From here, add these links below:
Code:
nameserver 8.8.8.8
nameserver 8.8.4.4
These are You do not have permission to view the full content of this post. Log in or register now., and we will use them as our DNS resolver.
Make sure to press ctr + c, the type :wq to save these changes.
We are almost done. Make sure to restart our network changes by running:
Code:
systemctl restart network
Once completed, run :
Code:
ip addr
You should see your IP address as shown below:
One way to test if you have an internet connection is to ping a site. In our case, I will ping google.com
Press ctrl + c to stop the command.
At this point, you should have a working CentOS 7 with an internet connection. Well done.
Next thread, let us install an SSH in CentOS 7 Minimal Server.