LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 11-19-2022, 04:15 PM   #1
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Rep: Reputation: 0
grant internet access to centos 8 VMs in vmware workstation


Hi,

i have connected 4 centos8 VMs to 192.168.1.0/24 using LAN segment option in vmware.

i picked 192.168.1.1 VM and i added another network adapter using NAT option.

i gave all the 3 other VMs the ip addr : 192.168.1.1 as a gateway.

i can reach the internet on 192.168.1.1, but the other 3 VMs could not !, can you help me ? thank you.
 
Old 11-19-2022, 07:14 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Did you configure 192.168.1.1 as a routing or forwarding device?

That does not happen by magic, someone has to set it up.
 
Old 11-20-2022, 02:35 AM   #3
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wpeckham View Post
Did you configure 192.168.1.1 as a routing or forwarding device?

That does not happen by magic, someone has to set it up.
yes, i have : net.ipv4.ip_forward = 1, in /etc/sysctl.conf of 192.168.1.1, but still the 3 VMs don't connect to internet.
 
Old 11-20-2022, 02:37 AM   #4
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
yes, i have : net.ipv4.ip_forward = 1, in /etc/sysctl.conf of 192.168.1.1, but still the 3 VMs don't connect to the internet.
 
Old 11-20-2022, 06:28 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
If the output of the command is zero i.e.
cat /proc/sys/net/ipv4/ip_forward
0

Then IP forwarding is disabled. To enable IP forwarding use the following command.
echo 1 > /proc/sys/net/ipv4/ip_forward

Editing the file should enable forwarding when the vm starts.
 
Old 11-21-2022, 11:07 AM   #6
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
the output is : 1, the VMs do ping each other locally (LAN), but they can't access the internet.
 
Old 11-21-2022, 11:48 AM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
Originally Posted by mehdi2020 View Post
the output is : 1, the VMs do ping each other locally (LAN), but they can't access the internet.
Good first step. Now, can the nodes all ping 192.168.1.1 and get a success return?
If that fails, we have our issue identified. If not, we will need more steps. Troubleshooting is rarely a one step to answer process.
 
Old 11-21-2022, 02:27 PM   #8
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
yes, they ping 192.168.1.1
 
Old 11-21-2022, 06:12 PM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
And I presume 192.168.1.1 can ping the nodes successfully. (Correct me if that is wrong.)

Is there a firewall running either on the host, or on 192.168.1.1, or on any of the nodes?

Can yo do packet tracing and log the packets?
 
Old 11-22-2022, 08:20 AM   #10
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
yes, that's the prblm : firewall; i fixed this issue with the command : iptables -t nat -A POSTROUTING -o ens160 -j MASQUERADE. thank you.

but now : the 3 VMs do ping 8.8.8.8, but they can't resolve domain name, i get this message when i try to do update or sth else :

Curl error (6): Couldn't resolve host name for http://mirrorlist.centos.org/?releas...am&infra=stock [Could not resolve host: mirrorlist.centos.org]

can you help me again. thank you.
 
Old 11-22-2022, 08:43 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Did you configure DNS for the VMs?
 
Old 11-22-2022, 09:18 AM   #12
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
yes, i configured 8.8.8.8 in the DNS for the VMs, but still they can't resolve domain name.
 
Old 11-22-2022, 10:07 AM   #13
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Do they all have the same /etc/resolv.conf?
What does the /etc/resolv.conf look like on those nodes?
 
Old 11-22-2022, 11:43 AM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Are you using network manager?
How did you configure dns on the vms?
 
Old 11-22-2022, 12:41 PM   #15
mehdi2020
LQ Newbie
 
Registered: Nov 2022
Posts: 12

Original Poster
Rep: Reputation: 0
this is what i have in /etc/resolv.conf :

# Generated by NetworkManager
nameserver 8.8.8.8
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How To Migrate Virtualbox VMs Into KVM VMs In Linux LXer Syndicated Linux News 0 07-10-2020 01:01 AM
XEN or VMWARE workstation for Windows VMs on Debian dobradude45 Debian 2 12-14-2013 06:56 AM
VMWare workstation 9: SL 6.3 Live DVD in VMWare Workstation:"unable to find the usable disk space" ravik453 Linux - Virtualization and Cloud 3 03-04-2013 02:47 PM
[Tcptraceroute/Traceroute/Ping] Windows VMs & Linux VMs BiFo Linux - Networking 0 08-24-2010 02:07 PM
LXer: Using Xen With LVM-Based VMs Instead Of Image-Based VMs (Debian Etch) LXer Syndicated Linux News 0 01-14-2009 08:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 09:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration