Showing posts with label ip. Show all posts
Showing posts with label ip. Show all posts

Wednesday, 27 April 2016

Ubuntu LXD container: no IP address

sudo dpkg-reconfigure -p medium lxd

Be very careful, this will wipe any existing lxc/lxd bridge you have and make your existing containers unreachable. So this is really only recommended if you are using LXD for the first time on your machine.

See comment section of https://www.stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/

"This change was required to be able to decouple LXD from the old LXC tools, moving it onto its own bridge. The warning message was highlighting the reasons for that, the effect it would have on existing containers and how to configure it so things would work as usual."

Thursday, 5 June 2014

OpenVPN: push all LAN traffic through an OpenVPN client to the other side

  1. Local variables for this post, adjust to fit your setup:
    1. OpenVPN client server IP
      1. 192.168.1.200
    2. Remote network
      1. 172.16.1.0/24
  1. Add this to the client server that is using OpenVPN to connect to the remote server:
    1. sudo iptables -A POSTROUTING -o tun0 -j MASQUERADE
    2. as root user, do
      1. echo 1 > /proc/sys/net/ipv4/ip_forward
  2. Add this to your local computer 
    1. Linux: 
      1. ip route add 172.16.1.0/24 via 192.168.1.200
    2. Mac:
      1. route -n add 172.16.1.0/24 192.168.1.200
Now, you should be able to ping from your local computer, through the client machine, and to a server in the remote network. Once that works, try ssh.

NOTE: take a look at /etc/sysctl.conf if you want the ip_forward to last through reboots of client server: net.ipv4.ip_forward=1

Friday, 20 September 2013

Set IPs on vagrant-lxc VMs

Cross-communication is always nice.

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.define "web", primary: true do |web|
    web.vm.box = "quantal64"
    web.vm.provider :lxc do |lxc|
      lxc.customize 'network.ipv4', '10.0.3.100/32'
    end
  end

  config.vm.define "db" do |db|
    db.vm.box = "quantal64"
    db.vm.provider :lxc do |lxc|
      lxc.customize 'network.ipv4', '10.0.3.101/32'
    end
  end

end


FYI, versioning info:

vagrant -v
Vagrant 1.3.3

vagrant plugin list
vagrant-lxc (0.6.0)

Monday, 17 September 2012

VLANs with iproute on CLI

Set up VLAN "20" on eth0
  1. Base
    1. ip link add link eth0 name eth0.20 type vlan id 20
    2. ip link set dev eth0 up
    3. ip link set dev eth0.20 up
  2. Manually assign
    1. ip addr add 192.168.20.100/24 dev eth0.20
    2. ip route add 192.168.20.0/24 dev eth0.20
    3. ip route add default via 192.168.20.1
Delete
  1. ip route delete 192.168.20.0/24 dev eth0.20
  2. ip link set dev eth0.20 down
  3. ip link delete eth0.20
Notes: "name" may be anything you wish, but then in subsequent commands, you must use it, which can be a bit hard to spot. Take a look at "eth0.20", and try changing it to a random string for testing.

Saturday, 8 September 2012

mac delivery mechanism


  1. your computer has a default gateway set 
    1. can figure out packet is not destined for the local network
    2. will use the MAC address of the default gateway 
  2. default gateway receives the layer-2 frame
    1. will see that the MAC address matches it's own
    2. will un-encapsulate the data link frame and 
    3. pass the data part up to the network layer
  3. at the network layer, layer 3
    1. will see that the destination IP address does not match it's own
      1. this is a packet that is supposed to be routed
    2. will look in it's routing table for the closest match
      1. which interface to send the packet out on
  4. will create a new data link frame addressed to the next hop
    1. data portion of this frame sent out the appropriate interface
  5. process will continue at each router along the way

Assume that none of the info in already cached in an ARP table on any of the machines or routers 
  1. your computer wants to send some data to a computer on network 3
    1. your computer will create an IP packet addressed to 200.0.3.2
    2. your computer will send out an ARP request for the default gateway's MAC address 
    3. on receiving the MAC address, your computer will send out the IP packet
      1. encapsulated within a data link frame that is addressed to the MAC address of router a's interface on network 1
  2. router a will receive this frame
    1. send the data portion up to the network layer 
    2. at the network layer, router a will see that the packet is not addressed to router a
    3. router a will look in it's routing table to find out where to send the packet
    4. routing table will show that network 3 is reachable via network 2
    5. routing table will also show the IP address for the next hop is 200.0.2.2
    6. router a will send out an ARP request onto network 2 asking for router b's MAC address
    7. on receiving MAC, router a will send the IP packet 
      1. encapsulated in a data link frame addressed to router b's MAC address
  3. router b receives this frame it will do the same thing that router a did
    1. will send the IP packet up to the network layer
    2. see that the packet is not addressed to router b 
    3. will then look up in it's routing table for the closest match and see that it is directly connected to network 3
      1. here isn't a next hop router to send it to. 
    4. will send out an ARP request to learn the MAC address for 200.0.3.2
    5. when MAC is received, router b will send out the IP packet
      1.  encapsulated within a data link frame that is addressed to the MAC address of the destination computer
  4. destination computer will see that the data link frame is addressed to it
    1. will pass the IP packet to the network layer. 
    2. at the network layer, the IP address will also match that of the computer
    3. the data from the IP packet will be passed up to the transport layer

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...