Score:0

How can I connect to a device running windows from ubuntu that has no internet using a wired ethernet connection?

ps flag

I have little experience with linux, I was hoping to connect to an old windows pc i have lying around that has no wifi support. I have a Ethernet connection running between my server (that I have control of) and the old pc. I am running zorinos (ubuntu) on the main server.

guiverc avatar
cn flag
Only Ubuntu and official flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic here, refer to https://askubuntu.com/help/on-topic where you'll find other SE sites where you question will be welcome if you don't want to use a Zorin forum. (*One advantage of Ubuntu is it's many support options, you opted for Zorin so take advantage of its support options, or SE Unix & Linux* found in the on-topic link)
guiverc avatar
cn flag
Please be precise with details, Ubuntu has many products (Ubuntu Core [server], Ubuntu Server, Ubuntu Desktop along with many *flavors*) as well as many releases, and many Ubuntu-based (*but not Ubuntu systems*) such as Zorin. You question is *unclear* and mixes Ubuntu and Ubuntu-based (*non-Ubuntu*) details without any clear specifics as to what you're actually running, and asking about. Details matter.
Lazar Mitrovic avatar
ps flag
Thank you, I apologize for disturbing the ubuntu community and will try your advice.
Lazar Mitrovic avatar
ps flag
Also the only reason I'm asking this question here is because many of my issues have been solved from solutions found here.
guiverc avatar
cn flag
You're welcome to read/use this site for any GNU/Linux system, as they are all pretty much the same (*differences being mostly 'timing' related to when they grab packages from upstream projects*), but asking questions here assumes you're only using Ubuntu packages & provide release details (*so we can explore options*). On-topic *flavors* all use the same packages, being built by the same Ubuntu infrastructure using only a different *seed* file changing only what packages are used (on Ubuntu's base). This however isn't so with 3rd party systems like Zorin OS
Score:0
kr flag

There are a few ways to do it:

Option A: Make your Linux machine into a router:

Your Wi-Fi will be the WAN side and ethernet LAN

sudo su
# tell the kernel to do routing
echo 1 > /proc/sys/net/ipv4/ip_forward
# make sure that you can route traffic
iptables -P FORWARD ACCEPT
# NAT anything behind your router
iptables -t nat -A POSTROUTING -j MASQUERADE
# Turn off any local DNS resolvers that might interfere
echo nameserver 1.1.1.1 > /etc/resolv.conf
systemctl stop systemd-resolved
killall dnmsasq
# Run a local DHCP server on the LAN side
# change the interface to the right one
ifconfig eth0 192.168.20.1/24
dnsmasq -F 192.168.20.2,192.168.20.254 -i eth0 -d

Now any device you connect to the LAN side eth0 in this case, will get a DHCP address from your linux machine, and it will use the linux machine as the gateway and DNS, which in turn will use whatever you set on your Wi-Fi. If you reboot your machine these settings will disappear.

Option B: Bridge your connection

This option doesn't work with Wi-Fi adapters - that's a bit more complicated, but if you have 2 or more ethernet adapters, it's a great solution. It allows you also to do web filtering, traffic shaping, MitM attacks, etc.

sudo su
apt-get install bridge-utils
brtcl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
# Change eth0 and eth1 with your interface names
# "ifconfig" or "ip link" will show interface names. 
ifconfig eth0 up
ifconfig eth1 up
# only necessary if you want the machine itself to have internet
dhclient -d br0

This is also a temporary setting. You might have to stop any other networking managers you have, before you do this:

systemctl stop network-manager
systemctl stop networkamanger
systemctl stop networking
service network stop
???

If any of the systemctl commands fail, it just means they don't exist or are not necessary on your linux. I am not sure what service manager it uses... but you should have enough now to search for the steps or read the documentation and see how to do it on your machine.

Fun fact: no matter how you do it, under the hood almost all routers and Linux machines do the above behind the curtain.

If you want to make the changes permanent, you will have to figure out what service or network manager your Linux uses, and edit its config files to accomplish the same as the above. Maybe this will work:

Option C: Bridge connection with network manager

ip a # check which devices you need to bridge
sudo nmcli c add type bridge con-name my-bridge ifname eth0
sudo nmcli c add type bridge con-name my-bridge ifname eth1
sudo nmcli c connect my-bridge

This should make it permanent. Although I could never get network manager to really do what I wanted it to despite reading the docs, and always end up just disabling it and creating my own config in /etc/rc.local.

guiverc avatar
cn flag
Did you actually test this? A quick scan & I can see a number of problems that I'd expect to return nothing but error. It's also made up of commands that are *deprecated* thus require installing before they're available for *modern* products.. (*bionic* isn't *modern* being EOSS, but a quick check on a *manifest* and one command I looked up is **not** included on a default *bionic* install)
Lazar Mitrovic avatar
ps flag
I was thinking of just buying an old display adapter and a usb wifi antenna. Thank you everyone for offering help though.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.