Networking

Here is some general networking information.

To upload an ssh key to a server:

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

To cat a file contents to the sytem clipboard:

cat file | xclip -selection clipboard

To get ssh-add automatically setup see here.

To connect to an ssh server using a specific key:

ssh -i work_computer paul@24.0.147.52

The -i following by a path to the public key you want to use.

Authorized keys are stored in the following file.This is where you add a key with no new lines! One key per line following by the hostname.

 ~/.ssh/authorized_users 

To change basic ssh settings such as disabling password authentication go to this file.

 /etc/ssh/sshd_config 

To disable a network adapter.

sudo ip link set down enp0s31f6

To enable a network apadter:

sudo ip link set up enp0s31f6

Notes from Steve Gordon's Lab:

ifconfig and ethtool are great tools that can give you the following info:

  • MAC Address: 50:7b:9d:f0:bf:3c
  • IP Address: 192.168.1.14
  • Network Address: This is some thing you can calcated using the mask
  • Simplex, half or full - full
  • Speed 1000

Some commands we used:

This gives us statistics.

ethtool -S eth0

This changes the speed of our port! The duplex command needs to be sent in also

ethtool -s eth0 speed 100 duplex full

Statistics on your network:

netstat -s 

How does my computer discover the hardware address of other computers. Theres a protocol that happens in the background, called address resolution protocol that find the hardware address based on the ip.

Use the arp command.

We want to see who is currently connected to us:

netstat -t 

To get a feel of what ports are in use read the file:

/etc/services

To see the routing table:

netstat -r

Ok, cool, I'm finding shit with this.

Avahi, is a name resolution service that broadcasts out the name of the machine. It is automatically installed in ubuntu and to use it you have to just apped .local to the end of the hostname. You can try this also:

avahi-resolve -n dev-laptop.local

Ok so this is a complicated thing. To resolve over my openvpn, its gonna be equal pain in the dick. So, if i'm at the shop, just export the ROS_MASTER_URI to dev-laptop.local and td1.local and if i'm over vpn, use the ips. Easy peasy.

To look at link information:

nmcli dev wifi

When needing to set up a VPN server use OpenVPN and use the roadwarrior script provided here.

When connecting to the open VPN server make sure to check the box “Use connection only for resources on this network”. This allows the connecting computer to retain its original default gateway and not mess up the internet connection. To test route do:

sudo ip route
Enter your comment. Wiki syntax is allowed:
 
  • networking.txt
  • Last modified: 2019/03/01 20:26
  • (external edit)