[SOLVED]how to connect via ssh to a mageia installed on vbox

[SOLVED]how to connect via ssh to a mageia installed on vbox

Postby systems » Sep 16th, '14, 22:05

greetings,

i have a problem connecting via ssh to mageia which i installed on
virtualbox

i followed the instruction found on this link
http://wiredrevolution.com/virtualbox/s ... -guest-vms

which worked fine (more or less) for slackware, openbsd and netbsd
the trick was finding the correct file to edit and figuring out the syntax

for slackware the file was /etc/rc.d/rc.inet1.conf
for openbsd the file was /etc/hostname.em1
for netbsd the file was /etc/ifconfig.wm0

of the 3, netbsd was the hardest to configure, both for find the
correct file name and the correct syntax
slackware was the easiet since the file was prefilled with the field
and i only completed the value

(sorry for this long introduction)

for mageia i configured enp0s8 from the control center, but as the end
of the setup i got this error message
Problems occurred during the network connectivity test.
This can be caused by invalid network configuration, or problems with your modem or router.
You might want to relaunch the configuration to verify the connection settings.

and the content of /etc/sysconfig/network-scripts/ifcfg-enp0s8
is
Code: Select all
DEVICE=enp0s8
BOOTPROTO=static
IPADDR=192.168.56.110
NETMASK=255.255.255.0
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=no
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=no

also note, that on slakcware, openbsd and netbsd sshd was installed by
default, i had to install this myself for mageia

i am at the moment clueless on where to move next and how to solve
this

any advice?

thank you

[update]
when i run
Code: Select all
ifup enp0s8

i get
Code: Select all
NETLINK: Error: File exists
Last edited by systems on Sep 17th, '14, 21:32, edited 2 times in total.
systems
 
Posts: 3
Joined: Sep 16th, '14, 09:23

Re: how to connect via ssh to a mageia installed on virtualb

Postby systems » Sep 17th, '14, 21:23

So I solved this puzzle, to solve it i needed 3 things, and i will explain below why

1- I added a gateway to the configuration of the second network interface (enp0s8) (then I rebooted)
2- I modified the configuration of enp0s8 again and set METRIC to 100
3- I went to Mageia Control Center > Security > Set up your personal firewall, and I enabled SSH Server and Echo request (PING)


And here is why I needed to do this

As I said in my previous post i was unable to bring up enp0s8, I was getting error, adding the gateway (filling the gateway pararemeter in the configuration)
after I rebooted enp0s8 was up, but enp0s3 was down, to fix this I modified the METRIC parameter to 100, this supposedly give it a lower priority and allow enp0s3 to be broought up
(i really have no idea what this METRIC parameter mean, its stuff I found online when researching this error "NETLINK: Error: File exists" which i was getting when i was trying to bring enp0s8 up, few posts online suggested that when two interfaces have the same metric, they compete over the gateway and one of them fail, something like that ... again, i am really weak in networking, so i dont fully understand what this mean)

Anyway, I now had both interfaces up, all what was left is to configure the firewall to allow SSH connection ( i got the tip to do this from this link:https://wiki.mageia.org/en/Nomachine)

My final comment, is that ... this was all a bit too tricky, at least compared to slackware, in slackware in didnt need to add a gateway to the second network interface, i didnt need to resolve a conflict between the network interfaces (the one connecting me to the internet, and the one connecting me to the the virtualbox host), i didnt need to install ssh, and i didnt need to configure a firewall

I really dont know what I needed to configure the gateway on enp0s8, or change the METRIC parameter, if someone here can explain this it would be highly appreciated :)

And fore completeness, here is not the configs of the two network interfaces
Code: Select all
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8
DEVICE=enp0s8
BOOTPROTO=static
IPADDR=192.168.56.110
NETMASK=255.255.255.0
GATEWAY=192.168.56.1
ONBOOT=yes
METRIC=100
MII_NOT_SUPPORTED=no
USERCTL=no
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=no


# cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
DEVICE=enp0s3
BOOTPROTO=dhcp
NETMASK=255.255.255.0
ONBOOT=yes
METRIC=10

systems
 
Posts: 3
Joined: Sep 16th, '14, 09:23

Re: how to connect via ssh to a mageia installed on virtualb

Postby doktor5000 » Sep 17th, '14, 21:27

Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18052
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [SOLVED]how to connect via ssh to a mageia installed on

Postby jiml8 » Sep 18th, '14, 15:08

I am quite puzzled about why you had to go to all this trouble (though I did not follow the link in your first post). You should have been able to set up your Mageia VM with one network interface that would communicate with both your host and with the internet. I do that all the time; I have at least a half dozen Mageia VMs right now ( as well as a couple dozen other VMs of various flavors, and the number is growing rapidly) and the only time I EVER find myself editing the config scripts is when I am doing something that is not default (which, actually, is quite often).

If you set up multiple network interfaces (as you apparently did) then commonly you will have to set up your routing and gateways because this tells the system how you want to use these interfaces - otherwise, it can't know that. I am not sure why you did this, but unless you had a particular need you should not have done it - you made your job a lot harder than it had to be. If you had simply set up one interface, the system would have handled the whole thing.

And, yes. The shorewall firewall will bite you in the butt; it bites me all the time, and I have three physical NICs and up to 6 virtual NICs running in this workstation of mine, as well as a full routing suite and a dhcp server. The flip side is that you have really fine-grained control over what can come into and out of your system because of shorewall.

Starting the ssh server (sshd) should be as simple as installing it, starting it, and telling shorewall to let it through. Then you should be done. That is not to say you are perfectly secure; configuring sshd for security is something that requires a bit of study. But, for most of my VMs, I don't bother. I only bother with that handful that I wish to be able to access from elsewhere on the internet. Given that I almost always tunnel into my LAN using a VPN then access the LAN and the VMs connected to it as if I am local, configuring sshd for my various VMs is not usually something I spend much time on.

METRIC defines the relative cost of a particular route. This cost is determined by whatever performance criteria is important; time delay, speed, $ per bandwidth, load on servers, or whatever else. Lower metric routes are cheaper than higher metric routes, and when a packet is routed it will take the cheapest route that can reach the destination. Ordinarily, in a home or small business LAN, you don't want more than one path to a destination and, if you do have more than one path and want both to be used, you need to play with the bonding device (and I won't go into that, but you are configuring it when you mess with the sysconfig files).

I did not take the time to study your setup. But it sure looks to me like you took the long way around the barn.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest

cron