set ip PC gateway
# ifconfig eth0 192.168.0.6 netmask 255.255.255.0
set default gateway in PC gateway(internet sharing)
# route add default gw 192.168.0.5
- enable IP forwarding
# echo 1 > /proc/sys/net/ipv4/ip_forward
or
# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
- set firewall
# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
or use SNAT
# iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT 192.168.0.6
- show rule
iptables -t nat -nL
- to make permanent set in /etc/rc.local
nb : 192.168.0.5 --> IP DSL Modem / router
192.168.0.6 --> IP PC gateway(Internet Sharing)
Wednesday, March 21, 2012
Monday, March 12, 2012
Reinstall GRUB in RHEL Linux
# grub
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.
grub> quit
# reboot
grub> root (hd0,0)
root (hd0,0)
Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd0)
setup (hd0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... yes
Checking if "/grub/stage2" exists... yes
Checking if "/grub/e2fs_stage1_5" exists... yes
Running "embed /grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.
grub> quit
# reboot
Subscribe to:
Posts (Atom)