- Turn off all "Network Manager" type processes and applications
- Comment out /etc/network/interfaces entries even
- Do all commands as the root user
- Monitoring changes
- In one terminal, run this command and watch it as you execute the commands below to see what is changing
- sudo watch -d 'ip addr;echo =====;ip link;echo =====;ip route'
- Add VLAN
- ip link add link eth0 name eth0.20 type vlan id 20
- ip link set dev eth0 up
- ip link set dev eth0.20 up
- ip addr add 192.168.20.190/24 dev eth0.20
- ip route add default via 192.168.20.1
- For any other VLANs, change the "20" in the commands above to the desired VLAN, e.g.
- ip link add link eth0 name eth0.100 type vlan id 100
- Delete VLAN
- ip link delete eth0.20
- Abstract commands
- Create
- ip addr add IP/NETMASK dev INTERFACE.VID
- ip link set dev INTERFACE.VID up
- ip addr add 192.168.100.101/24 dev eth0.100
- ip link set dev eth0.100 up
- Destroy
- ip link set dev INTERFACE.VID down
- ip link set dev eth0.100 down
- ip link delete INTERFACE.VID
- ip link delete eth0.100
- Notes
- Network addr does not have to match the VLAN name
- VLAN name is arbitrary, you can call it "joe" if you'd like
- http://www.linuxjournal.com/article/7268
- "Trunks using the 802.1q protocol work by adding a 4-byte VLAN identifier to each frame"
- "When a switch receives a tagged unicast frame, it looks up the outgoing port using both the destination MAC address and the VLAN identifier"
- "When a broadcast frame is received, it is flooded out to all active ports participating in that VLAN"
Saturday, 29 September 2012
VLAN on Linux CLI
Monday, 17 September 2012
Anti-window, anti-desktop Linux desktop
- Install base debian with NO additional packages
- apt-get install xorg openbox obmenu slim terminator firefox wicd-gtk
- reboot
- Log in to openbox via slim
- Right-click on blank desktop and open default terminal
- Run obmenu
- Edit ~/.config/openbox/menu.xml to add things you like
- Set up network including wireless using early post on this blog
- It is not easy
- but nice to know once you learn
Debugging pfsense firewall rules clearly and easily
- Status -> System logs -> Settings
- Make sure Log packets blocked by the default rule is not checked
- Check Show log entries in reverse order
- Increase to 500 Number of log entries to show
- Status -> System logs -> Settings -> Firewall
- Dynamic View
- You don't have to hit refresh
- Normal View
- Make sure to hit refresh if you expect a rule was triggered by your or others actions
- Firewall -> Rules
- Under the interface(s) you want to debug
- Create a default deny rule at the end of the rule list
- Choose Log packets that are handled by this rule
- Give the rule a very unique name
- For other rules you want to debug
- Choose Log packets that are handled by this rule
- Give the rule a very unique name
- Hang out on Status -> System logs -> Firewall -> Dynamic View
- Tweak rules until you see the result you desire
- Packets blocked that should be blocked
- Packets allowed that should be allowed
- Click on the red/green blocked/accepted icons
- Will show a pop-up for the rule triggered, showing the unique name you gave to the rule
- If necessary, go back and give more unique names to rules to distinguish them from one another
VLANs with iproute on CLI
Set up VLAN "20" on eth0
- Base
- ip link add link eth0 name eth0.20 type vlan id 20
- ip link set dev eth0 up
- ip link set dev eth0.20 up
- Manually assign
- ip addr add 192.168.20.100/24 dev eth0.20
- ip route add 192.168.20.0/24 dev eth0.20
- ip route add default via 192.168.20.1
- ip route delete 192.168.20.0/24 dev eth0.20
- ip link set dev eth0.20 down
- ip link delete eth0.20
Tuesday, 11 September 2012
pfsense under Virtualbox
This is very brief. Not completely complete. An outline. A hint.
NOTE: Did you get stuck, blocked, lost? Let me know on which step, thanks.
- Download pfsense iso
- Download Ubuntu Desktop iso
- Create a VM for the pfsense
- two interfaces
- Adaper 1
- Enable Network Adapter
- NAT
- Adaper 2
- Enable Network Adapter
- Internal Network
- intnet
- add the pfsense iso as a Storage
- Empty
- On the far right, there is a disk icon with a drop-down arrow
- Choose a virtual CD/DVD disk file...
- Select the pfsense iso on your local drive
- OK
- Boot the pfsense and hit "I" (capital eye) at the appropriate time to install pfsense to the VM's hard drive
- em0 and em1 will be the interfaces to use
- not found automatically in my case
- Rest of pfsense install not covered here
- Install Ubuntu as normal
- Adapter 1
- use intnet
- Start up Ubuntu desktop and log into 192.168.1.1or some similar gateway IP
NOTE: Did you get stuck, blocked, lost? Let me know on which step, thanks.
Add Virtualbox "Guest Additions" to Ubuntu Desktop 12.04
- The VM must be running to install the Guest Additions, so start up the VM
- Once the VM window shows the booted instance, find the "Devices" menu option at the very top of the encapsulating window (this is hard to make clear/clarify) but don't do anything with it yet.
- Make sure you are logged into your user's desktop on the VM
- On the VM, make sure your user has root privileges (not covered here), also called "sudo" privileges
- Choose Devices -> Install Guest Additions
- Confirm all prompts to download and mount the virtual CD from Virtualbox, this may take a while to download/complete
- Run the install when prompted
- Reboot the VM
- Send issues
Labels:
desktop,
guest additions,
ubuntu,
virtualbox,
vm
Saturday, 8 September 2012
mac delivery mechanism
- your computer has a default gateway set
- can figure out packet is not destined for the local network
- will use the MAC address of the default gateway
- default gateway receives the layer-2 frame
- will see that the MAC address matches it's own
- will un-encapsulate the data link frame and
- pass the data part up to the network layer
- at the network layer, layer 3
- will see that the destination IP address does not match it's own
- this is a packet that is supposed to be routed
- will look in it's routing table for the closest match
- which interface to send the packet out on
- will create a new data link frame addressed to the next hop
- data portion of this frame sent out the appropriate interface
- process will continue at each router along the way
- your computer wants to send some data to a computer on network 3
- your computer will create an IP packet addressed to 200.0.3.2
- your computer will send out an ARP request for the default gateway's MAC address
- on receiving the MAC address, your computer will send out the IP packet
- encapsulated within a data link frame that is addressed to the MAC address of router a's interface on network 1
- router a will receive this frame
- send the data portion up to the network layer
- at the network layer, router a will see that the packet is not addressed to router a
- router a will look in it's routing table to find out where to send the packet
- routing table will show that network 3 is reachable via network 2
- routing table will also show the IP address for the next hop is 200.0.2.2
- router a will send out an ARP request onto network 2 asking for router b's MAC address
- on receiving MAC, router a will send the IP packet
- encapsulated in a data link frame addressed to router b's MAC address
- router b receives this frame it will do the same thing that router a did
- will send the IP packet up to the network layer
- see that the packet is not addressed to router b
- will then look up in it's routing table for the closest match and see that it is directly connected to network 3
- here isn't a next hop router to send it to.
- will send out an ARP request to learn the MAC address for 200.0.3.2
- when MAC is received, router b will send out the IP packet
- encapsulated within a data link frame that is addressed to the MAC address of the destination computer
- destination computer will see that the data link frame is addressed to it
- will pass the IP packet to the network layer.
- at the network layer, the IP address will also match that of the computer
- the data from the IP packet will be passed up to the transport layer
Friday, 7 September 2012
CLI random break time generator
- echo $((RANDOM%20+1)) | xargs -i utimer -c {}m && xfe
- export HIGH=$((RANDOM%20+10));for i in `seq 1 ${HIGH}`;do echo $i:${HIGH};sleep 60;done
Monday, 3 September 2012
Cleaning up configuration files of removed Debian packages
If you want to rid yourself of those annoying packages showing up with a "rc" in the first field of "dpkg -l", do this as root, with prejudice:
dpkg -l | egrep '^rc ' | awk '{print $2}' | xargs dpkg -PLet the good times roll!
Labels:
cleaning,
configuration,
debian,
packages,
removing
Debugging Munin loaning graphs locally
- Problems
- Munin is a pain to debug remotely -- on prod -- when doing custom "loaning" graphs
- Varnish gets in the way
- (might not work, test yourself) fast-cgi doesn't work with new Munin 2.0 dynamic graph generation very well, just comment it out in the Apache config
- These issues combined leads to a complete nightmare of caching and having to wait for graphs to be regenerated so you can see your changes
- Troubleshooting
- Try this link for perm checks
- IMPORTANT: ust turn this on in monit.conf manually, since debian turns it off, and who knows who else
- graph_strategy cgi
- Solution
- Grab /var/lib/munin from production server
- Install Munin 2.x or greater on your local box
- Comment out the Munin files under /etc/cron* whatever/whereever, so your server doesn't try to update any of the files under /var/lib/munin
- Move your local copy of /var/lib/munin aside
- Move the production version of /var/lib/munin into place on your local system
- Copy perms of your original /var/lib/munin to new one
- Grab the prod server version of /etc/munin/munin.conf
- Move your local copy of /etc/munin/munin.conf aside, rename something you'll remember
- Move prod server version /etc/munin/munin.conf in place on your local box
- Use "munin-html" to regenerate html pages as you make changes to your munin definitions in /etc/munin/munin.conf
- basically these commands, but, for details, see http://blog.loftninjas.org/2010/04/08/an-evening-with-munin-graph-aggregation/
- sudo su - munin -s /bin/bash
- /usr/share/munin/munin-html --debug
- might work / might not
- Hit munin locally through your web browser; if you're lucky, all the prod info/graphs appear normally
- Now, you can update /etc/munin/munin.conf as you like and graph changes and errors will show up instantly
- Tweak URL to hit graphs you know the name of but munin-html failed to find for you
- Long-term
- Refresh the data from prod every 48 to 72 hours so your graph data doesn't fall off the chart
- Since your local box is not updating data, all rrd data will be blank from the time your grab it from prod's /var/lib/munin
Wireless with dead-simple Debian install
I had to do these steps to get wireless working with dead-simple install of Debian.
- Most commands done as root user
- There may be missing steps, let me know, it was a mess to get working, and I don't recall all steps perfectly
- run this the whole time as root to see changes as they occur, or not
- watch -d 'ip addr;echo =====;ip link;echo =====;ip route'
- install broadcom drivers for my network card
- Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller
- /etc/apt/sources.list
- deb [arch=amd64,i386] ftp://ftp.fu-berlin.de/pub/unix/linux/mirrors/debian/ wheezy non-free
- aptitude update
- aptitude install firmware-brcm80211
- add your user to netdev group and restart X
- netdev:x:113:yourusername
- load network card kernel modules into the kernel
- modprobe brcmsmac
- don't use the "-r" option, only works to reload, not initial load
- /etc/init.d/dbus reload
- no idea what this does or if necessary
- apt-get install wireless-tools
- verify
- lspci -v
- shows kernel module used, or not if failed to load, see last line per section for kernel module loaded for that device
- lsmod | grep brc
- shows list of kernel modules loaded
- else, they failed to load
- ip link
- see if there is a wlan0
- iwlist scan
- returns wireless networks in the area
- apt-get install apt-get install wicd-gtk wpasupplicant
- run wicd-gtk and try to connect that way, otherwise, do below
- /etc/network/interfaces
- #auto wlan0 # comment this out unless you want device started on boot
- iface wlan0 inet dhcp
- wpa-ssid YOURSSID
- wpa-psk YOURWIFIPASSWORD
- gateway YOURGATEWAYIP
- ifup wlan0
Labels:
broadcom,
firmware,
iwlist,
kernel,
lsmod,
lspci,
modules,
wireless-tools,
wlan0,
wpa-supplicant
Subscribe to:
Posts (Atom)
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...
-
kubectl --cert=/tmp/tls.crt --key=/tmp/tls.key create secret tls tls-wc-ingress
-
apt-get install exim4 dpkg-reconfigure exim4-config Select: internet site; mail is sent and received directly using SMTP IP-addresses...
-
brew install python3 mkdir -p ~/bin/python3 python3 -m venv ~/bin/python3 source ~/bin/python3/bin/activate enjoy!