commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
the below command create a alias for share your internet connection with another.
ifconfig eth0:1 192.168.0.1/24
Its obviously necessary too activate the iptables post-routing and ip forwarding, as root:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Be sure that the alias 192.168.0.0/24 is not your active real ip range
There are 3 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.