"Pipe" Wi-Fi signal through Ethernet cable
Yes, you can do this, and it's not even that hard. I have a laptop with a wireless card, and an ethernet port. I plugged a RapberryPi running Arch Linux into it, via a "crossover" ethernet cable. That's one special thing you might need - not all ethernet cards can do a machine-to-machine direct connection.
The other tricky part is IP addressing. It's best to illustrate this. Here's my little set-up script. Again, enp9s0 is the laptop's ethernet port, and wlp12s0 is the laptop's wireless device.
#!/bin/bash
/usr/bin/ip link set dev enp9s0 up
/usr/bin/ip addr add 172.16.1.1/24 dev enp9s0
sleep 10
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -j MASQUERADE
iptables -A FORWARD -o enp9s0 -i wlp12s0 -s 172.16.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
dhcpd -cf /etc/dhcpd.enp9s0.conf enp9s0
The script sets a static IP address for the ethernet card, 172.16.1.1, then sets up NAT by loading a kernel module. It turns on IP routing (on the laptop), then does some iptables
semi-magic to get packets routed from the wireless card out the ethernet, and vice versa.
I have dhcpd
running on the ethernet port to give out IP addresses because that's what the Raspberry Pi wants, but you could do a static address on your workstation, along with static routing, DNS server, and NTP server.
The file /etc/dhcpd.enp9s0.conf
looks like this, just in case you go down that route:
option domain-name "subnet";
option domain-name-servers 10.0.0.3;
option routers 172.16.1.1;
option ntp-servers 10.0.0.3;
default-lease-time 14440;
ddns-update-style none;
deny bootp;
shared-network intranet {
subnet 172.16.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
pool { range 172.16.1.50 172.16.1.200; }
}
}
The IP address choice is pretty critical. I used 172.16.1.0/24 for the ethernet cable coming out of the laptop. The wireless card on the laptop ends up with a 192.161.1.0/24 . You need to look at what IP address the laptop's wireless has, and choose some other subnet for the ethernet card. Further, you need to choose one of the "bogon" or "non-routable" networks. In my example, 172.16.1.0/24 is from the official non-routable ranges of IP addresses, as is 192.168.1.0/24, and so is the 10.0.0.3 address dhcpd.enp9s0.conf
gives out for a DNS server and NTP server. You'll have to use your head to figure out what's appropriate for your setup.