=====Ubuntu General Documents===== This section contains my documentation for generic features that are typically common across different Ubuntu versions. ====Administration==== ===Installing package clusters=== Using Apt, one can install many different packages for a purpose using the meta-packages. For example, the different developer packages (gcc, make, bison, etc) required for compiling most different open source projects can be installed using ''build-essential'': root@saturn:~# apt-get install build-essential Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: binutils cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 libc6-dev libstdc++6-4.1-dev linux-libc-dev make patch Suggested packages: binutils-doc cpp-doc gcc-4.1-locales debian-keyring gcc-4.1-doc lib64stdc++6 manpages-dev autoconf automake1.9 libtool flex bison gdb gcc-doc libc6-dev-amd64 lib64gcc1 glibc-doc libstdc++6-4.1-doc make-doc diff-doc Recommended packages: libmudflap0-dev The following NEW packages will be installed: binutils build-essential cpp cpp-4.1 dpkg-dev g++ g++-4.1 gcc gcc-4.1 libc6-dev libstdc++6-4.1-dev linux-libc-dev make patch 0 upgraded, 14 newly installed, 0 to remove and 35 not upgraded. Need to get 12.9MB of archives. After unpacking 49.7MB of additional disk space will be used. Do you want to continue [Y/n]? y A brief (and incomplete) list of meta-packages follows: * ubuntu-desktop * kubuntu-desktop * xubuntu-desktop * bcp for full libboost * xserver-xorg-video-all all xorg libs ===Swapping CTRL with CAPSLOCK on the console=== Use the following procedure to swich the CTRL with the CAPSLOCK on a standard PC keyboard. # dumpkeys > /usr/share/keymaps/defkeymap.kmap # cp /usr/share/keymaps/defkeymap.kmap /usr/share/keymaps/ctrlcaps_switch.kmap # vi /usr/share/keymaps/ctrlcaps_switch.kmap # diff /usr/share/keymaps/defkeymap.kmap /usr/share/keymaps/ctrlcaps_switch.kmap 1342c1342 < keycode 29 = Control --- > keycode 29 = Caps_Lock Caps_Lock Caps_Lock Caps_Lock 2575c2575,2576 < keycode 58 = Caps_Lock Caps_Lock Caps_Lock Caps_Lock --- > keycode 58 = Control > # loadkeys /usr/share/keymaps/ctrlcaps_switch.kmap Naturally, the ''loadkeys'' command at the end needs to be run each time one logs in. Simply add this to the .bashrc to make the change automatic. (It may be advisable to not add the ''loadkeys'' command to root's .bashrc, just in case... ;-) Alternatively, xmodmap can be used in Xwindows. The man page gives the exact details but basically put the lines ! ! Swap Caps_Lock and Control_L ! remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L in a file (.xmodmap is good). Then add the line xmodmap ~/.xmodmap in your .bash_profile or some other file that is run when you login or start x. ===Installing a Wireless NIC=== ==Installing the Drivers== The ndiswrapper package can be used to install a wireless adapter, using the Windows drivers provided by the manufacturer. The following example was done using the TrendNET Wireless NIC. The Win2K drivers were copied from the CD supplied with the card and the following procedure was executed: # ndiswrapper -i Mrv8000c.INF installing mrv8000c ... # ndiswrapper -m adding "alias wlan0 ndiswrapper" to /etc/modprobe.d/ndiswrapper ... # ndiswrapper -l mrv8000c : driver installed device (11AB:1FAA) present modprobe wlan0 The last step only needs to be done for the current boot session. Because ndiswrapper adds it to /etc/modprobe.d/ndiswrapper, the kernel module created in the first step will be loaded automatically on reboot. ==Configuring the Interface== Add the appropriate configuration to the ''/etc/network/interfaces'' file, for example (be sure to add wlan0 to the ''auto'' line): # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface # automatically added when upgrading auto lo wlan0 iface lo inet loopback iface wlan0 inet static address 192.168.0.2 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.10 Edit the ''/etc/wlan/wlan.conf'' file to add the SSID for your network. It may be necessary to edit the following two files: * ''/etc/network/if-pre-up.d/linux-wlan-ng-pre-up'' * ''/etc/network/if-post-down.d/linux-wlan-ng-post-down'' The TrendNET card had issues with the ''wlanctl-ng'' command. Commenting out the section where ''wlanctl-ng'' was run and changing the ''modprobe'' statement to specifically reference wlan0: if ! modprobe wlan0; then echo "Failed to load wlan0." >&2 exit 1 fi # NOTE: We don't explicitly insmod the card driver here. The # best thing to do is to specify an alias in /etc/modules.conf. # Then, the first time we call wlanctl with the named device, # the kernel module autoload stuff will take over. # But, if you prefer, you could modprobe it here. # Bring the card up into an operable state. #result=`$WLANCTL $IFACE lnxreq_ifstate ifstate=enable` #if [ $? = 0 ] ; then # eval $result # if [ $resultcode != "success" ]; then # echo "Failed to enable the device, resultcode=" $resultcode "." >&2 # exit 1 # fi #else # echo "Failed to enable the device, exitcode=" $? "." >&2 # exit 1 #fi # ====Networking==== ===Permanent static routes=== Add the following lines to ''/etc/network/interfaces'' up route add -net 172.16.0.0/24 gw 172.16.4.1 dev eth0 === Installing Argus === [[ http://www.qosient.com/argus/downloads.htm | argus download ]] apt-get install libpcap0.8-dev bison libwrap0-dev flex === Receiving Netflow === apt-get install flow-tools # grep mnt /etc/flow-tools/flow-capture.conf -w /mnt/data/log/flow/ -N 3 0// -w /mnt/data/log/flow/ -N 3 0// === Processing pcap with Argus === From http://www.qosient.com/argus/gettingstarted.shtml **Analysing Packet Files** Argus processes packet data and generates summary network flow data. If you have packets, and want to know something about whats going on, argus() is a great way of looking at aspects of the data that you can't readily get from packet analyzers. How many hosts are talking, who is talking to whom, how often, is one address sending all the traffic, are they doing the bad thing? Argus is designed to generate network flow status information that can answer these and a lot more questions that you might have. If your running argus for the first few times, get a packet file from one of the IP packet repositories, such as pcapr and process them with argus(). Once you have both the server and client programs and a packet file, run: argus -r packet.pcap -w packet.argus ra -r packet.argus ===== Server Functions ===== ====Enabling remote syslog over UDP==== Add the following to /etc/defaults/syslogd: SYSLOGD="-r" ===== VMware ESXi ===== ==== Cloning issues with eth0 and eth1 ==== Edit /etc/udev/rules.d/70-persistent-net.rules Delete the line with eth0 and change eth1 to eth0: SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:97:00:35", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:97:00:38", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"