Showing posts with label wifi. Show all posts
Showing posts with label wifi. Show all posts

Friday, July 13, 2018

Ubuntu how to setup a vpn connection, tsocks, corporate wifi with openconnect and openvpn or socks

These are just notes.

Cisco vpn setup with CSD support [corporate setup]


# install
sudo apt-get install openconnect network-manager-openconnect-gnome gconf2 lib32z1 lib32ncurses5 libpangox-1.0-0

#restart network-manager or reboot the laptop


Create ~/.cisco folder

mkdir ~/.cisco 

Download the csd-wrapper-sh from github

https://gist.github.com/l0ki000/56845c00fd2a0e76d688#file-csd-wrapper-sh

copy the csd-wrapper.sh to that folder

Edit the file and set the CSD_HOSTNAME

CSD_HOSTNAME=vpn-1-gci.yourcompany.com

Run the script to download the resources, one time, and make sure the resources are downloaded.

bash ~/.cisco/csd-wrapper.sh

On gnome shell, settings->network add a vpn connection


Command line with CSD support:

# open a connection with csd support, use --background to run as daemon
sudo openconnect --user=lafa --csd-user=lafa --csd-wrapper=/home/lafa/.cisco/csd-wrapper.sh --background --pid-file=${HOME}/vpn.pid vpn-1-gci.yourcompany.com:443/GeneralHybrid

Without CSD support

# select dynamic updates
sudo dpkg-reconfigure resolvconf

Gnome network manager GUI configuration

[This is not needed for Ubuntu 15.04 and 16.10]. The default routing rules are missing in ubuntu openconnect 15.10/16.04. After the network manager establishes the connection, the work around is to add a default route as specified below after the connection is established. Start a console and type the command below with the correct arguments.

sudo route add default netmask 255.255.255.0 gw 10.87.154.223 dev vpn0

run ifconfig to figure out the vpn device name, the gateway ip of the vpn device normally tun0 or vpn0.

Execute the command above and the default route should make the openconnect vpn work.

Command line without network manager

# open a connection, use --background to run as daemon
sudo openconnect --user=USERID server/group/

# open a connection with csd support, use --background to run as daemon
sudo openconnect --user=lafa --csd-user=lafa --csd-wrapper=/home/lafa/.cisco/csd-wrapper.sh --background --pid-file=${HOME}/vpn.pid vpn-1-gci.yourcompany.com:443/GeneralHybrid


# to stop the connection you can ctrl-c the terminal running openconnect or

sudo killall openconnect*

Setup openvpn using ibvpn.com provider and openvpn

sudo apt-get install openvpn easy-rsa network-manager-openvpn-gnome

goto http://www.ibvpn.com

setup a free account

extract openvpn.tgz where you want

On UbuntuGnome goto settings->network->add
select vpn->Import from file

Select ibVPN-US-Dallas.ovpn


Type your email
Get the password from the ibvpn website, this is not you ibvpn account password.




Select Add.
And try it out.

Using  a socks proxy instead of VPN


# run a local socks server
ssh -D 9999 proxy.server

# setweb browser proxy or gnome network proxy in gnome network settings.
proxy: localhost:9999

# To use other apps with socks install
sudo apt-get install tsocks

# Change config file to (remove everything else)
/etc/tsocks.conf
server = 127.0.0.1
server_port = 9999

# ssh to a machine
tsocks ssh -X bla.corp.com

# eclipse to a machine
tsocks eclipse

Using Cisco client


sudo apt-get update
sudo apt-get install lib32z1 lib32ncurses5 network-manager-openconnect libpangox-1.0-0
cd ~/Downloads
tar -xzvf anyconnect-predeploy-linux-64-4.3.05017-k9.tar\ 6.59.23\ AM.gz
sudo vpn_install.sh
sudo apt-get install network-manager-openconnect
sudo systemctl daemon-reload

# check if the process is running
ps auxw | grep vpnagentd | grep -v grep

# add alias to bash
cat >> ~/.bash_aliases
alias vpn='/opt/cisco/anyconnect/bin/vpn'
alias vpnui='/opt/cisco/anyconnect/bin/vpnui'
^D

# Fix certificates to use ubuntu certs
cd /opt/.cisco/certificates
sudo mv ca ca.orig
sudo ln -sf /etc/ssl/certs/ ca
sudo /etc/init.d/vpnagentd restart

Cisco download

https://software.cisco.com/download/home/286281283/type/282364313/release/4.6.01103

Reference: http://www.socsci.uci.edu/~jstern/uci_vpn_ubuntu/

Saturday, August 27, 2016

Ubuntu how to setup a vpn connection, tsocks, corporate wifi with openconnect and openvpn or socks

These are just notes.

Cisco vpn setup [corporate setup]


# install
sudo apt-get install openconnect network-manager-openconnect-gnome

VPN GUI setup
# select dynamic updates
sudo dpkg-reconfigure resolvconf


#restart network-manager or reboot the laptop


#  create a new VPN openconnect connection, set only the gateway
nm-connection-editor

Gnome network manager GUI configuration

[This is not needed for Ubuntu 15.04 and 16.10]. The default routing rules are missing in ubuntu openconnect 15.10/16.04. After the network manager establishes the connection, the work around is to add a default route as specified below after the connection is established. Start a console and type the command below with the correct arguments.

sudo route add default netmask 255.255.255.0 gw 10.87.154.223 dev vpn0

run ifconfig to figure out the vpn device name, the gateway ip of the vpn device normally tun0 or vpn0.

Execute the command above and the default route should make the openconnect vpn work.

Command line without network manager

# open a connection, use --background to run as daemon
sudo openconnect --user=USERID server/group/

# to stop the connection you can ctrl-c the terminal running openconnect or

sudo killall openconnect*

Setup openvpn using ibvpn.com provider and openvpn

sudo apt-get install openvpn easy-rsa network-manager-openvpn-gnome

goto http://www.ibvpn.com

setup a free account

extract openvpn.tgz where you want

On UbuntuGnome goto settings->network->add
select vpn->Import from file

Select ibVPN-US-Dallas.ovpn


Type your email
Get the password from the ibvpn website, this is not you ibvpn account password.




Select Add.
And try it out.

Using  a socks proxy instead of VPN


# run a local socks server
ssh -D 9999 proxy.server

# setweb browser proxy or gnome network proxy in gnome network settings.
proxy: localhost:9999

# To use other apps with socks install
sudo apt-get install tsocks

# Change config file to (remove everything else)
/etc/tsocks.conf
server = 127.0.0.1
server_port = 9999

# ssh to a machine
tsocks ssh -X bla.corp.com

# eclipse to a machine
tsocks eclipse

Monday, May 12, 2014

Ubuntu, Kubuntu, UbunutGnome 14.04 support for high resolution in Yoga Pro 2

Support for high resolution in Yoga Pro 2

I installed the 3 Ubuntu variants from scratch in Yoga Pro 2, to test what was the best support for the hardware and Hires.

On the hardware front all the Ubuntu 14.04 support the Yoga Pro 2 very well, see the other posts.

On HiRes all distros have problems. The best is UbuntuGnome 14.04.

UbuntuGnome detects the HiRes from the beginning and most applications installed by default don't have any problems.

Ubuntu with Unity requires going to settings and select the menu scale to 2 and after that is very similar to UbuntuGome, but the problem with Ubuntu with Unity is that most of the default apps still don't support Hires.

Kubuntu requires tweaking fonts, icons and several other settings, to be able to use native resolution, and is not perfect but very usable.

If you decide to go with 1080p, all the 3 distros work great.

If you are really like Hires I would recommend going with UbuntuGnome for now.

ubuntugnome.org

Screen shoot on my Yoga Pro 2


www.ubuntu.com

Screen shoot on my Yoga Pro 2


See the other posts for more detail on each distro.

UbuntuGnome 14.04 running on yoga pro 
 
Ubuntu 14.04 running in yoga pro 2

Kubuntu14.04 running in yoga pro 2


UbuntuGnome 14.04 running on Yoga Pro 2

UbuntuGnome running on Yoga Pro 2



I just got a Yoga Pro 2 and installed UbuntuGnome from http://ubuntugnome.org on it, works great.

Create a USB boot drive with another Ubuntu machine, plug the USB stick on it.

Yoga Keys boot key

F12 - Boot menu to select booting from usb drive
F2 - Bios Menu

Power down the computer. Push the “novo” button ounce or press F2 while booting, to force the computer to enter into BIOS menus. Disable “Security Boot” and disable “Lenovo Fast Boot”. Leave UEFI option turned on since Ubuntu 14.04 supports UEFI out of the box. I also enabled the Functions keys in the BIOS by default, but this is not required, personal preference.

Create to boot USB disk


Avoid using something like Unetbootin to create a UEFI-bootable flash drive, it does not work yet.

Format your flash drive with a single FAT32 partition.  Copy the contents of the Ubuntu ISO (use your favorite archiving tool - 7zip for example) or CD to it.  Use a recent 64-bit Ubuntu version.

That's all you need to do.  No need to install a boot loader or use special tool.

You can also use Ubuntu tool for UEFI bootable flash drive.

 After install

UbuntuGnome will boot with full resolution, also Gnome 3.10 supports HiRes. Select the partition size for Ubuntu let the UbuntuGnome installer resize your windows partition. Grub will have an option to boot windows after the install is done and will setup Ubuntu as the default OS.

In UbuntuGnome 14.04 to make bluetooth and wifi work you need to blacklist the ideapad_laptop module
$ cat /etc/modprobe.d/blacklist-ideapad_laptop.conf
blacklist ideapad_laptop


After this reboot the laptop, this will enable wifi, bluetooth.

What works

Almost everything works great out of the box in UbuntuGnome 14.04, there isn't many changes you need to do.

Sound works

Options keys for sound work, side sound button up/down works.

Screen

Everything works, brightness, resolution changes, even the option key to turn off the screen and brightness.

Camera

Works fine.

Sleep works

No issue.

Keyboard works

Keyboard background light works, menu key works, Special Fn key mute, volume up, volume down, turn off screen, refresh, brightness up and down, menu key, keyboard light, side buttons for up and down volume, work as expected.

Wifi and bluetooth works

No issues.

Does not work out of the box

Special Fn keys,   show all screens, side mute button, disable track-pad function, air-plane mode function,.

Optional SSD tunning

This fstab change is optional and should reduce the amount of writes to your ssd, no real problem here just a personal preference.
In Ubuntu 14.04 fstrim is enabled by default on /etc/cron.weekly/fstrim, no need to tweak anything else for SSD.

On /etc/fstab file change the root mount line to add extra parameters and mount /tmp and /var/tmp as a tmpfs, as described below:

UUID=9-5-4-a / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0

tmpfs /var/tmp tmpfs defaults,noexec,nosuid 0 0

Setting to use Hi-res

UbuntuGnome 14.04 supports Hi-res by default, no changes required.

Tweaks to make some Apps work better with Hi-Res

Firefox works fine with Hires, but you need to scale to 200% every new web site you open, or install NoSquint and Grab and Drag add ons, to make firefox more tablet friendly.

Chromium renders the site with the correct scale, but Chromium menu is not usable in Hires, chromium supports the touchscreen better than firefox if you wish to use it with the touchscreen Chromium is the better choice.

You can change the scale factor on the cmd line, by running:
gsettings set org.gnome.desktop.interface scaling-factor 1

Run chromium at device scale in case it starts with big fonts.
chromium-browser --force-device-scale-factor=1

Cheese and Totem, have problem with the video scale, it plays and works fine but the video only fills 1/4 of the area it is supposed to fill.

Ubuntu extras and tools

sudo apt-get install flashplugin-installer

sudo apt-get install ubuntu-restricted-extras

sudo apt-get install p7zip-rar p7zip-full unace unrar zip unzip sharutils rar uudeview mpack arj cabextract file-roller htop dconf-editor gnome-tweak-tool

#media players [lots of packages for these]
sudo apt-get install vlc clementine minitube

# DVD support
sudo apt-get install gstreamer0.10-plugins-ugly libxine1-ffmpeg gxine mencoder libdvdread4 totem-mozilla icedax tagtool easytag id3tool lame nautilus-script-audio-convert libmad0 mpg321 libavcodec-extra


sudo /usr/share/doc/libdvdread4/install-css.sh

Touchpad

sudo gedit /etc/X11/Xsession.d/80xinput

xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Profile" 2
xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Constant Deceleration" 8
xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Adaptive Deceleration" 8
xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Accel Velocity Scaling" 8
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Finger" 35 45 0
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Coasting Speed" 5 15
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Time" 120
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Tap Move" 300
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Noise Cancellation" 20 20
xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 1 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Circular Scrolling" 8 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Palm Detection" 8 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "CornerCoasting" 8 1

Fonts


You can use the gnome-tweak-tool or dconf-editor to change the font settings for gnome apps.

Firefox and Chrome don't use the gnome configuration for fonts, but you can create a file in your home dir with

gedit ~/.config/fontconfig/fonts.conf

firefox and chrome will use that file.

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="autohint">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
<dir>~/.fonts</dir>
</fontconfig>


For more fonts:
http://www.google.com/fonts

Intel Video drivers [not recomended]

Follow the link https://01.org/linuxgraphics/downloads.

# Download "Graphics Installer 1.0.5 for Ubuntu* 14.04, 64-bit"
sudo dpkg -i intel-linux-graphics-installer_1.0.5-0intel1_amd64.deb

# Run
intel-linux-graphics-installer

You can scale the screen using
xrandr --output eDP1 --scale 0.7x0.7

How To Install GNOME 3.12 [not recomended]

This is not recommended but in case you want to try the latest Ubuntu gnome 3.12, here is a link below that describes the process:
http://www.webupd8.org/2014/05/how-to-install-gnome-312-in-ubuntu.html

sudo apt-get install bijiben polari gnome-clocks gnome-weather gnome-maps gnome-music install gnome-photos gnome-documents gnome-contacts epiphany-browser gnome-sushi gnome-boxes gnome-shell-extensions gnome-tweak-tool

Wifi network card upgrade [not recommended, only do it if you need dual band wifi]

I also upgraded the wifi network card to a intel dual band, link to amazon.
Youtube video how to upgrade to a dual band widi card, video link.

sudo lspci -v
01:00.0 Network controller: Intel Corporation Wireless 7260 (rev 6b)
    Subsystem: Intel Corporation Dual Band Wireless-AC 7260
    Capabilities: [154] Vendor Specific Information: ID=cafe Rev=1 Len=014
    Kernel driver in use: iwlwifi

USB 3 ethernet adapter

I got this on frys, below is the link for amazon. It works great

http://www.amazon.com/Diamond-Multimedia-Gigabit-Ethernet-UE3000/dp/B00DWXV4SY
I'm also using a SIIG usb 3 hub with power adapter to plug a sound logitech usb sound bar, the usb 3 ethernet adapter, and a external disk 60 Gb ssd disk.

http://www.amazon.com/SIIG-7-Port-USB-3-0-Adapter/dp/B00AAHLWA0/ref=sr_1_1?ie=UTF8&qid=1404719193&sr=8-1&keywords=siig+usb+3+hub


References

Ubuntu, Kubuntu, UbunutGnome 14.04 support for HiRes in Yoga Pro 2
Ubuntu 14.04 running in yoga pro 2
UbuntuGnome 14.04 running on yoga pro 2 
Kubuntu14.04 running in yoga pro 2

Other References

https://github.com/pfps/yoga-laptop

Sunday, May 11, 2014

Running Ubuntu 14.04 on Yoga Pro 2

Ubuntu running on Yoga Pro 2



I just got a Yoga Pro 2 and installed Ubuntu on it, works great.

Create a USB boot drive with another Ubuntu machine, plug the USB stick on it.

Yoga Keys boot key

F12 - Boot menu to select booting from usb drive
F2 - Bios Menu

Power down the computer. Push the “novo” button ounce or press F2 while booting, to force the computer to enter into BIOS menus. Disable “Security Boot” and disable “Lenovo Fast Boot”. Leave UEFI option turned on since Ubuntu 14.04 supports UEFI out of the box. I also enabled the Functions keys in the BIOS by default, but this is not required, personal preference.

After install

Ubuntu will boot with full resolution, leave that alone for the install if you can work the installer at that resolution, otherwise change "scale for menus" in settings screen panel. Select the partition size for Ubuntu let the Ubuntu installer resize your windows partition. Grub will have an option to boot windows after the install is done and will setup Ubuntu as the default OS.

After the installation is done, change go the System Settings->Displays and change the "Scale for Menu" to 2.

In Ubuntu 14.04 to make bluetooth and wifi work you need to blacklist the ideapad_laptop module
$ cat /etc/modprobe.d/blacklist-ideapad_laptop.conf
blacklist ideapad_laptop


After this reboot the laptop, this will enable wifi, bluetooth.

What works

Almost everything works great out of the box in Ubuntu 14.04, there isn't many changes you need to do.

Sound works

Options keys for sound work, side sound button up/down works.

Screen

Everything works, brightness, resolution changes, even the option key to turn off the screen and brightness. 

Sleep works

No issue.

Keyboard works

Keyboard background light works, menu key works, Special Fn key mute, volume up, volume down, turn off screen, refresh, brightness up and down, menu key, keyboard light, side buttons for up and down volume,  show all screens, work as expected.

Wifi and bluetooth works

No issues.

Does not work out of the box

Special Fn keys, side mute button, disable track-pad function, air-plane mode function,.

Optional SSD tunning

This fstab change is optional and should reduce the amount of writes to your ssd, no real problem here just a personal preference.
In Ubuntu 14.04 fstrim is enabled by default on /etc/cron.weekly/fstrim, no need to tweak anything else for SSD.

On /etc/fstab file change the root mount line to add extra parameters and mount /tmp and /var/tmp as a tmpfs, as described below:

UUID=9-5-4-a / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0

tmpfs /var/tmp tmpfs defaults,noexec,nosuid 0 0

Setting to use Hi-res

Ubuntu 14.04 supports Hi-res be default, just go to Settings->Displays and set the Scale for Menu to 2.

References

Ubuntu, Kubuntu, UbunutGnome 14.04 support for HiRes in Yoga Pro 2
Ubuntu 14.04 running in yoga pro 2
UbuntuGnome 14.04 running on yoga pro 2 
Kubuntu14.04 running in yoga pro 2

Setting dns over TLS on ubuntu 26.04 using quad9 and

With this change future dns queries should got to Quad9 and fallback Cloudflare if Quad9 has a outage, and should go over TLS.  Change /etc/...