I have a network with an internet access provider box as gateway and dhcp server in one room. And I have a wired network in the other side of the house and I can't pass a ethernet cable to it to provide internet. So I was wondering how to share my wifi connection over ethernet to get internet on this wired network. Bonus - I can only use console to do it.
This is what you need to know before attempting this:
How to connect your router via SSH or Telnet to configure IP and getway from router to your computer.
How to connect to the wifi.
How to create a LAN wired connection between computer and router.
If you know (more or less) these things, the process is this:
connect your computer to the wifi using this procedure: How do I connect to a WPA wifi network using the command line?.
once connected, check your connection in terminal using a command like
ping www.google.comand wait for a positive response
$ ping google.com PING google.com (22.214.171.124) 56(84) bytes of data. 64 bytes from lhr35s01-in-f14.1e100.net (126.96.36.199): icmp_seq=1 ttl=53 time=14.0 ms 64 bytes from lhr35s01-in-f14.1e100.net (188.8.131.52): icmp_seq=2 ttl=53 time=14.8 ms [...]
connect via SSH or Telnet via cable to the router and set correct IP and Gateway. The gateway mus be the IP of the ethernet card (not wifi) of the computer connected to wifi, but the IP can be random.
disconnect the router and create on the computer an ad-hoc wired connection with the IP set as your router gateway. To do this, you must set in the conf file "shared" type of connection.
connect again to the router using the PC cable and enter in it via SSH or Telnet and check with
pingif you have internet. I couldn't find any guide to "how to create ad hoc connection via terminal" and I'm not sure it's possible to connect a router via ad-hoc connection. So, as you can see, it's very very tricky.
Moreover, if you can do all this stuff and it works, my experience with ad-hoc connections tells that they are crap, they are slow, they go down for no reason if you have too much traffic, so I don't suggest using them.
The best way for you is to buy a range extender (repeater) and configure it with a computer using the GUI, with a fixed IP and getway etc, then set up (via SSH or Telnet) your cabled router, and connect them via LAN cable.
A second option is this: you need 2 computers: take computer number 1 and connect it to the wifi, check ping, if you have internet, connect via LAN cable to computer number 2, after connecting it create on computer number 1 an ad-hoc connection.
Then create on computer number 2 a new ethernet connection with the right IP and Gateway for the ad-hoc connection. You will have 2 computers connected.