CentOS 6.5 Network Configuration - networking

I've been trying to install CentOS 6.5 on a computer at work for the past couple weeks, but I'm getting stuck at configuring the newtork. I can't get an IP via DHPC. If I setup everything to be static, I get the network icon but not network at all (I can't even ping the gateway).
Maybe I'm missing something? It's a fresh install, and I have trying editing the network-scripts manually and also via the network manager tool. None seems to work, but it all works fine on my Windows computers, even with DHCP.
The router is at 172.16.0.100, subnet 255.255.255.0 and the computer IP could be anything, but I'm using 172.16.0.1.

As root what is the output of ifconfig?
This will display what networking devices have been configured by the system and what the status of them is.

service NetworkManager start;
chkconfig NetworkManager on
ip addr
or
ifconfig eth0 #ip up
or install and use webmin

Related

Is it possible to make "WSL" virtual switch external in Windows 20H2 (WSL2.0) and how to configure it?

It's not enough for me to bind WSL ports to localhost because I need to run applications in WSL which must be run in and from my local network. Attempt to switch WSL virtual switch to external in Hyper-V manager leads to Access-denied error (when wsl instance is running) with following big problems with host's and/or WSL's network as a result until I reboot the host. When WSL distro is not running WSL virtual switch is invisible in Hyper-V manager (Virtual switch manager).
I have 2 question and will be very appreciated if someone could help me with that:
Is it a normal behavior - having got problem with network attempting to configure WSL virtual switch directly? As I recall there were no such problems with Hyper-V virtual machines - maybe just short losing of connectivity, not more.
Is there a way to configure WSL such way so it starts with WSL external switch any time I run it? Files .wslconfig and /etc/wsl.conf look to be useless for this - I haven't managed to find the solution in google.
Yes you can convert it to external from Hyper-v Manager. Just start the Hyper-v Manager as Administrator
It is indeed possible to get this configuration to work with IPV4. This is quite tricky, as you need to act on the Network configuration to set an IP address in the external network, and this requires systemd to be enabled.
Install WSL and Ubuntu distribution
First ensure that you have WSL2 installed, and install it if this is not the case
https://learn.microsoft.com/fr-fr/windows/wsl/install
WSL documentation:
https://learn.microsoft.com/en-us/windows/wsl/
It is key to have Ubuntu installed for WSL2, as the KDE installation is not compatible with WSL1.
wsl --install Ubuntu-20.04
It is important to have a recent version of WSL (1.0 as of this writing), as it allows you to use systemd.
Configure networking
By default, WSL installs with NAT and a dynamic IP which changes each time WSL is restarted.
There are also very limited options to access network services brought by WSL, as only TCP ports can be proxied with netsh, not UDP ports. This causes all sorts of issues with X, as it is using UDP ports, and I have been totally unable to make X windows desktops work, despite HOWTOs online claiming success.
If you need additional tools, now is the time to install them, as you are going to lose network connectivity for some time.
apt install net-tools
Change from internal to external network (Hyper-V manager)
You need to open Hyper-V manager and go to the virtual switch management. There is a WSL switch which by default is configured as “Internal network”. You need to change it to “External network”.
You also need to select which physical adapter you are going to connect to, Ethernet or Wifi.
At this point and until you finish network configuration, you no longer have any network connectivity.
Your virtual network card is now connected to the external network, but it is not configured, which we are going to do now by means of systemd.
Configure you virtual network card
From within WSL, edit file /etc/wsl.conf so that it contains:
[network]
generateResolvConf = false
[boot]
systemd=true
Create a file named /etc/systemd/network/26-fixed-ip.network containing (example):
[Match]
Name=eth0
[Network]
Address=192.168.1.60/24
Gateway=192.168.1.1
DNS=192.168.1.30
Select a fixed IP address in your external network range, and adapt the above parameters according to your case.
Configure DNS resolution
We have already instructed WSL not to generate resolv.conf each time it is started, as seen above.
It is now time to configure /etc/resolv.conf to contain:
nameserver 192.168.1.30
nameserver 192.168.1.5
domain xxxxxxxx.net
Check connectivity
Stop and start wsl (from a Windows cmd prompt):
wsl --shutdown
wsl
When wsl is restarted, it gets the fixed IP address, instead of a random one. You may ping any IP address and it works. You may also ping your ip address from another host on your LAN:
ping 192.168.1.60
Yes you can, but it seems to work only in IPv6 in my situation:
When I ran wsl --shutdown and opened Hyper-V Manager, the WSL switch appeared in Virtual Switch Manager, and can be successfully changed to external.
However, the IPv4 address could not be changed, and it's unable to access the Internet via IPv4 either. So I have to assign a NAT IPv6 network (fd68::/64 in my case) to make it work.
Maybe you should do some repair to your system if you can't reproduce this.
Note: if switch WSL is changed to external, your main adapter will become vEthernet (WSL) or something similar.

Hyper-V Networking Does Not work on corporate network

I'll try to explain without confusing you.
I built multiple Hyper-V VM's (using External VS, not Internal VS) on Windows 10 and when I'm connected to my home network, all is well. I can get out to the internet. Everything works as expected.
When I connect to my corporate network via Eth, strange things happen.
Linux VM does not get an IP
Win10 Network Adapters show VS with a public IP - 146... (strange)
Laptop stops routing via corp network and instead is routing using the VS IP (also strange)
As I said, none of these problems occur at home so if there's a specific IT policy blocking me at work, I would appreciate knowing which one so I can tell my Help Desk what to fix. Or is it something else?
Thanks.
You may have to do a ipconfig /release and ipconfig /renew (Windows) or a sudo dhclient -v -r and sudo dhclient -v (Linux) on the remote machine to get it to renew its DHCP settings and retrieve an IP address.

SSH from Virtualbox Guest to DynDNS address

I have Windows 10 as host with a Manjaro installation as Guest on Virtualbox.
I have set a Debian server on another house with ssh installed. I have setup a dyndns on Debian's network so I can access it remotely.
For example..
From address 12.34.56.78 I ssh to foo.dyndns.org:1234. This port redirects me to 192.168.1.5:22 always as this is my Debian machine and the connection is established. I am able to do this from Windows 10 as well as my android and any other device in 12.34.56.78 or by 3G.
But..
When I try to do this
$ ssh foo.dyndns.org:1234
from the Manjaro Guest in Virtualbox I get the following error:
ssh: Could not resolve hostname foo.dyndns.org:1234: Name or service not known
So I did ifconfig and I saw my inet address was 10.0.2.15. I changed virtualbox's network adapter from NAT to Bridged so I can get a lan ip and I got the host's ip, 192.168.2.4. So I gave it another try and still didn't work.
Also, if i try to connect from vm to server while I'm in the same network
$ ssh user#192.168.2.5:22
it works. In this case virtualbox's network adapter was NAT.
This command works if I try from my android (connectbot).
I can connect the same way from PuTTY from Windows.
So my questions are:
Can it be done?
If so, how? (and why?)
Can a VBox Guest get lan ip that's not the same as the host's?
Is there any more information I should provide?
I have searched for a couple of days in here and on google and all I found where solutions on how someone can ssh INTO a vm. No one (from what I saw) asked the opposite.
Checking manual page for ssh reveals the format of command-line options:
ssh [...] [-p port] [...] [user#]hostnamessh
This simply describes, that you need to change
ssh foo.dyndns.org:1234
to
ssh -p 1234 foo.dyndns.org
if the domain resolves correctly to the ip address.

Virtualbox -- configuring two VMs to talk to each other / host and internet

Host: Windows 7 running lastest VBox + Extension pack
Vm1: lubuntu 3.10
Vm2: Ubuntu server 12.04.3
Problem: Can't get VMs talk/ping each other AND ping the internet at the same time
NAT: VMs have same IP, using ping/ssh is like checking connectivity/connecting to self, lol; can ping internet, can't ping each other
Bridged: VMs get unique IP; can ping each other, not the internet
Host-only: VMs get unique IP; can ping each other; not the internet
Internal network:
intnet, needs to be defined/added to windows 7, however, window 7 not accepting VBOXMANAGE add command, giving errors. VMs wait for network configuration, another 60 seconds and start without a network.
What else can I do?
Change VM to use NAT Network, generic driver... ???
edit /etc/network/interfaces?
change route?
use squid?
Following Lubuntu Networking Message pops up in Lunbutu GUI:
network service discovery disabled
your cuurent network has a .local domain which is not recommended and incompatible with the avahi network service discovery the service has been disabled.
Can anyone help?
Refresh your MAC address using Virtual Box machine settings and remove the kernel’s networking interface rules file so that it can be regenerated:
sudo rm -f /etc/udev/rules.d/70-persistent-net.rules
sudo reboot
It will work for your clone VM.

setting up networking on centos6 virtualbox guest with xp host

I'm using virtualbox and trying to get my centos6 virtual machine onto the network. Virtualbox is running on XP. In the virtual box settings I've enabled network adapter 1, selected the bridged adapter and selected the default hardware. On the virtual machine I've edited configuration files as follows (making sure that the mac address / hardware address matches the adapters mac address from the virutalbox settings):
# cat /etc/sysconfig/network-scripts/ifcofg-eth0
DEVICE="eth0"
BOOTPROTO="none
MACADDR="08:00:27:7D:A8:DC"
ONBOOT="yes"
IPADDR=10.0.20.10
GATEWAY=255.0.0.55
# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=dev.host.com
NETOWRKING_IPV6=no
GATEWAY=10.0.0.55
# cat /etc/sysconfig/networking/devices/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=08:00:27:7D:A8:DC
ONBOOT=yes
NETMASK=255.0.0.0
IPADDR=10.0.20.10
GATEWAY=10.0.0.55
TYPE=Ethernet
When i restart networking I get the following:
# /etc/init.d/network restart
Shutting down loopback interface:
Bringing up loopback interface:
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization.
eth0 never comes up and obviously I've got no access to / from the network.
There was a rule in /etc/udev/rules.d/ that was associating an old mac address from the cloned machine with eth0. I edited the rule (/etc/udev/rules.d/70-persistant-net.rules), to use the new mac address virtualbox generated when I enabled the network adapter.
eth0 is up and running - I can access the network. (thanks to the centos forum).
Not sure about this behavior in other Cent OS version or Linux distros but in Cent OS 6.1, /etc/udev/rules.d/70-persistant-net.rules is automatically generated by the OS and after a couple of reboots, it will be regenerated based on the Mac Addresses in the ifcfg-eth* files.
So I didn't have to edit the file. I just had to reboot the VM a 1-2 more times.
Device eth0 does not seem to be present, delaying initialization.
This is quite a generic error for a number of issues. UDEV can work often however renaming the NIC itself among other solutions such as specifying the HW address will work too. But that's not all of them. Give this older post a try. Looks like a collection for a bunch of solutions to this error:
Device eth0 does not seem to be present
Regards,
Always check the file format of ifcfg-ethX was not modified by a Windows editor. In case the line ends are in windows format, you will encounter the same problem.
This cause is hard to notice and the error message is misleading.

Resources