All,
As most of you know Ubuntu's Network Manager is a joke, not a real tool. Therefore to get connections made, we have to resort to bash scripts that can actually work, in making connections.
I wrote the following bash, originally to find and link the remote tethering from my phone. Worked well calling "My Stylo", but now I also have the "netis" wifi router in the mix, which it does not correctly connect to.
I get the "Connected" popup, but it will not ping. Think I'm missing the key/password for the essid but haven't found out how to pass that in.
Additionally I want the script to see if "netis" is available then connect there, or else connect "My Stylo". Haven't figured out how to query what's available
Wifi-Start.sh
Code:
#! /bin/bash
# Files needed for networking are:
# /etc/network/interfaces
# /etc/iptables
# /etc/resolv.conf
# /etc/sysctl.conf
# Find current wlan0 channel with
# iwlist wlan0 channel;
# Run the commands to start network passthru
#service networking restart;
#service network-manager restart;
ifconfig wlan0 down;
iwconfig wlan0 ap '78:92:9c:25:b5:d0';
#iwconfig wlan0 essid "My Stylo";
#iwconfig wlan0 freq 2.412;
iwconfig wlan0 essid "netis";
iwconfig wlan0 freq 2.437;
dhclient wlan0;
# Additional commands
sysctl -w net.ipv4.ip_forward=1;
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE;
ping -c 3 www.google.com
Additionally I had to write this bash script to connect on eth0 "wired". Originally I was calling/restarting network-manager, but when the wifi routers are also available, they try connecting, fail and the conflicts makes eth0 not work correctly, so had to disable those calls.
Code:
#! /bin/bash
# Script to start wired networking
echo "Shutting down IFACE and Networking!";
ifconfig eth0 down;
#service networking stop;
#service network-manager stop;
# Run the commands to restart dhcp client and assign IP Address
echo "Starting IFACE and Networking!";
#service networking 3start;
#service network-manager start;
ifconfig eth0 up;
echo "Starting DHC Client!";
dhclient eth0;
ping -c 3 www.google.com;
# Finish
Would appreciate help getting these working right so I have total control over my laptop. Right now I can only work from the wired port, so not able to be mobile with the laptop, which is it's whole purpose.
Cheers!
TBNK