Thursday, May 21, 2015

tcpdump wirte to screen and file

Basic form:
tcpdump -i interface OPTIONS -w - | tee outputFile | tcpdump -r -

-w - : write data to stdout
tee : write data to file and its own stdout
-r - : read data from stdin

Example:
tcpdump -i enp3s0 udp and port 53 -w - | tee packet.pcap | tcpdump -nn -r -

Tuesday, May 5, 2015

Use iptables for CentOS 7 instead of firewalld

CentOS 7 is now using firewalld instead of iptables. To use iptables, here are the steps:

1. Disable firewalld
systemctrl disable firewalld

2. Stop firewalld
systemctrl stop firewalld

3. Install iptables-services
yum install iptables-services

4. Enable iptables
systemctl enable iptables

5. Start iptables
systemctl start iptables

 6. Configure iptables as usual (/etc/sysconfig/iptables)

Monday, May 4, 2015

Wednesday, April 22, 2015

Completely remove nf_conntrack from kernel

1. Remove the following line, if it exists, in /etc/sysconfig/iptables-config
   IPTABLES_MODULES="ip_conntrack_netbios_ns"

2. Stop iptables
   iptables -F

3. Remove the related modules
   modprobe -r xt_NOTRACK nf_conntrack_netbios_ns nf_conntrack_ipv4 xt_state
   modprobe -r iptable_nat ipt_MASQUERADE nf_nat nf_defrag_ipv4
   modprobe -r nf_conntrack

Wednesday, February 25, 2015

Solution for VPN client not working after upgraded to Mac 10.10 Yosemite

Source: http://apple.stackexchange.com/questions/151345/vpn-client-is-not-working-after-yosemite-update-enforce-firewall-policy-fail

Solution: put computer into kext developer mode (-> 10.9 behavior)
   sudo nvram boot-args="kext-dev-mode=1"

To change back to 10.10 behavior (VPN client will not work)
   sudo nvram -d boot-args


After the change, you need to reboot the computer

Friday, January 16, 2015

rpath

Reference: http://ftp.gnu.org/pub/old-gnu/Manuals/ld-2.9.1/html_node/ld_3.html

Add directory to the runtime library search path, for shared object.

Example: Add runtime search path /tmp/igetui

gcc -Wl,-rpath,/tmp/igetui/ $(PLATFORM) $(DEBUG) -lpthread -ldl


OR add it to LD_LIBRARY_PATH
ex.
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/igetui

OR add it /etc/ld.so.conf and run ldconfig

Wednesday, November 12, 2014

Install Parallels Tools on CentOS for share folders

Source: http://tp69.wordpress.com/2012/10/03/parallels-tools-centos-server/
Issue: CentOS doesn't automatically mount it by default.
Solution: Mount it manually. Make sure your network connection is good in advance.

mount -r -t iso9660 /dev/sr0 /mnt/
cd /mnt
./install


Once done, restart the CentOS and the share folders will be automatically mounted on /media/psf

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX