general/other How to assign an additional IP/hostname to a Linux chrooted environment ?

Hello.

I've got a crazy idea that I want to share with you. Premising that I'm running FreeBSD 13R,I've created a Linux/Ubuntu chroot environment on FreeBSD. It works well for a lot of (graphical) applications. Recently I've installed the original VNC server on another instance of Ubuntu that I've emulated with bhyve. As u probably knows,it accepts the connections only if you use the original VNC-viewer client. So,I've thought : what about to install it inside the chroot environment of the Linux Ubuntu os that I have configurated in FreeBSD ? So,I did it and it worked. At least,the graphical interface runs correctly as u can see below. Unfortunately it does not work because it detects that the chroot environment doesn't have a real network stack and a real IP and it won't connect to any VNC server. So,is there an hacky method to assign a network stack and a real IP address to the chroot ? I tried to work on this crazy idea following the tutorials below but in front of the first problems I stopped...


https://unix.stackexchange.com/ques...itional-ip-hostname-to-a-chrooted-environment
https://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/


Code:
root@marietto:/usr/home/marietto # /usr/sbin/chroot /compat/ubuntu /bin/bash


root@marietto:/# uname

Linux



root@marietto:/# ip

Cannot open netlink socket: Address family not supported by protocol



root@marietto:/# ip netns

Cannot open netlink socket: Address family not supported by protocol



root@marietto:/# ifconfig

bridge: error fetching interface information: Invalid argument



root@marietto:/# sudo ip

sudo: unable to resolve host marietto: Temporary failure in name resolution

Cannot open netlink socket: Address family not supported by protocol



root@marietto:/# sudo ip netns add mario

sudo: unable to resolve host marietto: Temporary failure in name resolution

Cannot open netlink socket: Address family not supported by protocol

Screenshot_20211026_100625.png
 
Everyone wants to help me with this ? I read that a jail based on linuxulator can have the proper network configuration inside,including the hostname and one IP number. I've also read that a chroot is configured like a jail. BUT,if it is true,why the error above tells that I don't have an IP number ? Should I configure a jail from scratch or I can convert the chroot that I have configured into a jail ? What you suggest me to do ?
 
anyway,is there someone that has been able to run succesfully teamviewer using jail + linuxulator ?
 
Back
Top