1

I am running an Ubuntu laptop which is connected to WiFi and is capable of accessing internet. There is my old desktop machine which do not have the WiFi card. So I connected my laptop to WiFi and configured a proxy server on this machine and connected the desktop and laptop via LAN wire.

Now desktop is set to use the proxy server on the laptop machine. Problem is that laptop considers the eth0 interface as default interface and wlan interface as secondary interface. So when I connect the LAN to laptop, it cannot access internet using the wlan interface but it tries to connect over the eth0 interface( I think). how to assign the wlan2 as my primary interface. I am not asking how to share connection but how to change default connection

NIMISHAN
  • 1,575
  • 4
  • 19
  • 28
shiv garg
  • 283
  • I saw that post earlier...there are many ways to implement this task..i could configure a gateway in vm......but my real question is "is there a way to assign wlan as default interface" – shiv garg Dec 15 '15 at 18:51

1 Answers1

2

Read man ip-route, and do:

# show current routes
ip route | tee routes.saved

# delete old default route (YMMV, check output above)
sudo ip route del default dev eth0
# add the new default route
ROUTER_IP="the IP address of your router"
sudo ip route add default dev wlan2 via $ROUTER_IP

# show new routes
ip route | tee routes.new

As you have probably noticed, if you do not have a default route defined (and pointing to a co-operative next-hop), almost all TCP/IP packets go nowhere.

waltinator
  • 36,399