Recent Notes

Displaying notes 171 - 180
Created by magnum on September 27, 2011 12:55:51    Last update: September 27, 2011 12:55:51
These steps set up a Linux host as IPSec client, using Openswan . Install Openswan: # yum install openswan Edit /etc/ipsec.conf . Instead of L2TP on port 1701, I'm setting up TCP on port 8080 so that I can test the connection with nc . # /etc/ipsec.conf - Openswan IPsec configuration f... Edit /etc/ipsec.secrets . # include /etc/ipsec.d/*.secrets 192.168.0.101 ... Start IPSec: # /etc/init.d/ipsec start Connect to IPSec server: # ipsec auto --up TCP8080-PSK-CLIENT 104 "TCP80...
Created by magnum on September 27, 2011 09:32:18    Last update: September 27, 2011 09:33:04
Use tcpdump to monitor traffic on a network: To print all incoming and outgoing packets on host 192.168.0.1 : tcpdump host 192.168.0.1 To print all incoming and outgoing IP packets on host firebird : tcpdump ip host firebird To write raw packets to a file, rather than parsing and printing them out: tcpdump ip host firebird -w /tmp/firebird.pcap To listen on interface eth0 (without this, tcpdump listens on the lowest numbered, configured up interface except loopback): tcpdump -i eth0 ip Use switch -X for more verbose output: tcpdump -i eth0 ip -X host 192.168.0.1 Outgoing from 192.168.0.1 : tcpdump -i eth0 ip -X src host 192.168.0.1 Incoming to 192.168.0.1 : tcpdump -i eth0 ip -X dst host 192.168.0.1 More verbose output: tcpdump -i eth0 tcp -vvX host 192.168.0.1...
Created by magnum on September 26, 2011 21:13:20    Last update: September 26, 2011 21:13:20
To locate the first occurrence of a character: #include <string.h> const char * strchr ( const... To locate the last occurrence of a character: #include <string.h> const char * strrchr ( cons...
Created by magnum on September 26, 2011 21:04:24    Last update: September 26, 2011 21:04:39
This works for gcc: #include <string.h> if (strcasecmp(s1, s2) == 0... Otherwise, convert all chars with tolower and use strcmp .
Created by magnum on September 25, 2011 21:51:23    Last update: September 26, 2011 20:49:22
A simple socket client in C. #include <stdio.h> #include <stdlib.h> #incl...
Created by magnum on September 25, 2011 21:41:15    Last update: September 25, 2011 21:41:30
A simple C example for IP address lookup with gethostbyname . #include <netdb.h> #include <stdio.h> #inclu...
Created by Dr. Xi on September 24, 2011 20:59:16    Last update: September 24, 2011 21:00:20
To import source from my-project into the svn repository: $ svn import my-project/ file:///home/drxi/work/sv... List the contents of the repository: $ svn ls file:///home/drxi/work/svn-repository/ ... List the contents of the newly imported project: $ svn ls file:///home/drxi/work/svn-repository/my-...
Created by Dr. Xi on September 24, 2011 20:45:14    Last update: September 24, 2011 20:52:48
Use the svnadmin command to create a new svn repository: $ svnadmin create ~/work/svn-repository $ ls sv... There's no need to do " mkdir ~/work/svn-repository ", svnadmin will create it if it doesn't exist.
Created by woolf on September 23, 2011 15:02:15    Last update: September 23, 2011 15:02:15
There's no file for OpenWRT syslog. Instead, syslog is a fixed size buffer in memory. Use logread to look at syslog: root@OpenWrt:/# logread -h logread: invalid opt... To tail the log: root@OpenWrt:/# logread -f
Created by woolf on September 21, 2011 16:23:06    Last update: September 21, 2011 16:24:29
VirtualBox creates/uses a network adapter named vboxnet0 on the host, when a VM network adapter is connected as "host-only". As the VM starts, VirtualBox assigns the IP address 192.168.56.1 to vboxnet0 on the host. The VM DHCP client grabs the IP address 192.168.56.101 from the VirtualBox DHCP server. Connectivity is limited between the VM and the host - unless you configure NAT and IP forwarding on the host. For OpenWRT, if the DHCP client is not started automatically: #/sbin/udhcpc -i br-lan -p /var/run/udhcpc.pid -s ...