A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label network. Show all posts
Showing posts with label network. Show all posts

How to set network proxy from command line in Ubuntu

You might need to do this if your network settings dialog box crashes as I've seen on Ubuntu 13.10:

gsettings set org.gnome.system.proxy autoconfig-url http://myserver/myconfig.pac
gsettings set org.gnome.system.proxy mode auto

This is how I found out the settings:

$ for key in $(gsettings list-keys org.gnome.system.proxy); do echo $key = $(gsettings get org.gnome.system.proxy $key); done

autoconfig-url = 'http://myserver/myconfig.pac'
ignore-hosts = ['localhost', '127.0.0.0/8']
mode = 'auto'
use-same-proxy = false

It doesn't have to be a .pac file, ours is .dat.

(source)

How to fix ntpdate

# set 'server' value in config to the correct ntp date server on your network
$ sudo vim /etc/ntp.conf

# force update (1.2.3.4 is your ntp date server)
$ sudo /etc/init.d/ntpd stop
$ sudo /usr/sbin/ntpdate 1.2.3.4
$ sudo /etc/init.d/ntpd start


# check it worked (offset should be < 10)

$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 1.2.3.4            6.7.8.3      3 u    6   64    1    3.902   -0.216   0.001
 1.2.3.5            6.7.8.4      3 u    5   64    1    1.753    0.048   0.001


Why doesn't smbclient work?

Symptoms:
You can mount a NetApp 'shared drive' using the mount program fine.
But if you try to browse it using smbclient, you get this error when it fails to connect:
session setup failed: NT_STATUS_MORE_PROCESSING_REQUIRED

Cause:
A bug in Ubuntu 11.04

Workaround:
Change your hostname to a short string, without any hypens (dashes) in it!

(copy)

Use lighttpd as a proxy-pass server

$HTTP["host"] =~ "made.up.hostname" { # hostname you want to create
    $SERVER["socket"] == ":1234" { # port you want to create

        server.errorlog      = "/var/logs/madeup/lighttpd-error.log"
        accesslog.filename   = "/var/logs/madeup/lighttpd-access.log"

        proxy.server = ( "" =>
                           ( ( 
                               "host" => "123.456.789.012", # where you want to proxy to
                               "port" => 5678, # port you want to proxy to
                             ) ) 
                         )   
    }   
}

# Now go to http://made.up.hostname:1234 and you will get directed through to http://123.456.789.012:5678



VirtualBox commands


VBoxManage showvminfo [appliance name] |grep NIC

NIC 1 Rule(0):   name = AMQ admin page, protocol = tcp, host ip = 127.0.0.1, host port = 6666, guest ip = , guest port = 8161
NIC 1 Rule(1):   name = PRL, protocol = tcp, host ip = 127.0.0.1, host port = 5555, guest ip = , guest port = 5000
NIC 1 Rule(2):   name = SSH, protocol = tcp, host ip = 127.0.0.1, host port = 2222, guest ip = , guest port = 22
NIC 1 Rule(3):   name = XT, protocol = tcp, host ip = 127.0.0.1, host port = 8888, guest ip = , guest port = 8529
NIC 1 Rule(4):   name = web, protocol = tcp, host ip = 127.0.0.1, host port = 8080, guest ip = , guest port = 80