Search This Blog

Monday, June 16, 2014

Ubuntu - setup port forwarding

To enable port forwarding on Ubuntu:

nano /etc/sysctl.conf

uncomment:
net.ipv4.ip_forward=1


Restart the system and check whether ip forwarding is enabled:
cat /proc/sys/net/ipv4/ip_forward

192.168.0.0   - NETWORK you're forwarding the traffic TO
10.0.0.0. - NETWORK you're forwarding the traffic FROM
IP - just your ip address in 10.0.0.0 network taken from eth0 interface


#!/bin/sh
IP="$(ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}')"
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 0.0.0.0/0 -j SNAT --to-source $IP
iptables -t nat -A POSTROUTING -s 192.168.0.123/32 -d 0.0.0.0/0 -j SNAT --to-source 192.168.0.100

#forward :5556 (10.0.0.0 network) -> :22 (192.168.0.0 network)
iptables -t nat -A PREROUTING -p tcp --dport 5556 -j DNAT --to 192.168.0.123:22
iptables -A FORWARD -p tcp -d 192.168.0.123 --dport 5556 -j ACCEPT



Thursday, June 12, 2014

Android - change MAC address of eth0

Requirements: root & busybox

To change:
ifconfig eth0 hw ether 00:11:b2:13:14:55

To check your current MAC address:
iplink show eth0




Thursday, June 5, 2014

Ubuntu 14.04 x64 - install NTP service


sudo apt-get install openntpd

sudo nano /etc/openntpd/ntpd.conf



add lines:
listen on *
servers 127.0.0.1


sudo service openntpd restart