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
Tuesday, February 21, 2012
Add samba user
At this point you should be able to see the samba server from any windows system in the same workgroup but you won't be able to access the share; not until you add the user(s).
Samba authenticates its users through its local database. Once you have saved the changes to smb.conf , you need to add the users.
Since you enabled the encrypted password option in your smb.conf, you need to add the users with encrypted password.
Add your existing users to samba or create new users and then add them to samba.
[root@server2 samba]# smbpasswd –a agustin
New SMB password: ********
Retype new SMB password:********
Enter the password in 8 character length or more, if you enabled the user name length specification, then it must meet the requirement. Note that agustin is an existing user in the system.
Note. If the command fails it is because the password file does not exist. Retouch the file with the following command and try again.
[root@server2 samba]# touch /etc/samba/smbpasswd
Finally change the smbpasswd security to 644
[root@server2 samba]# chmod 644 smbpasswd
That command will make it read only!
Samba authenticates its users through its local database. Once you have saved the changes to smb.conf , you need to add the users.
Since you enabled the encrypted password option in your smb.conf, you need to add the users with encrypted password.
Add your existing users to samba or create new users and then add them to samba.
[root@server2 samba]# smbpasswd –a agustin
New SMB password: ********
Retype new SMB password:********
Enter the password in 8 character length or more, if you enabled the user name length specification, then it must meet the requirement. Note that agustin is an existing user in the system.
Note. If the command fails it is because the password file does not exist. Retouch the file with the following command and try again.
[root@server2 samba]# touch /etc/samba/smbpasswd
Finally change the smbpasswd security to 644
[root@server2 samba]# chmod 644 smbpasswd
That command will make it read only!
Tuesday, December 27, 2011
Install Apache mod_proxy_balancer
Install Apache mod_proxy_balancer
#cd /u01/source
#tar xvzf httpd-2.2.21.tar.gz
#cd httpd-2.2.21
#./configure --prefix=/u01/apache --enable-so
#make
#make install
cd httpd-2.2.21/modules/metadata
#/u01/apache/bin/apxs -a -i -c mod_headers.c
cd httpd-2.2.21/modules/proxy
#/u01/apache/bin/apxs -a -i -c mod_proxy.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_connect.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_http.c
if error when start apache, solve with running below
#/u01/apache/bin/apxs -a -i -c mod_proxy.c proxy_util.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c proxy_util.c ajp_utils.c ajp_header.c ajp_msg.c ajp_link.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c proxy_util.c
#cd /u01/apache/conf
#echo "Include conf/proxy-pass.conf" >> httpd.conf
#vi proxy-pass.conf
Header add Set-Cookie "ROUTEID=%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
BalancerMember http://localhost:6001 route=node1
BalancerMember http://localhost:6002 route=node2
ProxySet stickysession=ROUTEID
ProxyPass /context balancer://cluster/context
ProxyPassReverse /context balancer://cluster2/context
--start apache
#/u01/apache/bin/apachectl start
--stop apache
#/u01/apache/bin/apachectl stop
#cd /u01/source
#tar xvzf httpd-2.2.21.tar.gz
#cd httpd-2.2.21
#./configure --prefix=/u01/apache --enable-so
#make
#make install
cd httpd-2.2.21/modules/metadata
#/u01/apache/bin/apxs -a -i -c mod_headers.c
cd httpd-2.2.21/modules/proxy
#/u01/apache/bin/apxs -a -i -c mod_proxy.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_connect.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_http.c
if error when start apache, solve with running below
#/u01/apache/bin/apxs -a -i -c mod_proxy.c proxy_util.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_ajp.c proxy_util.c ajp_utils.c ajp_header.c ajp_msg.c ajp_link.c
#/u01/apache/bin/apxs -a -i -c mod_proxy_balancer.c proxy_util.c
#cd /u01/apache/conf
#echo "Include conf/proxy-pass.conf" >> httpd.conf
#vi proxy-pass.conf
Header add Set-Cookie "ROUTEID=%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
BalancerMember http://localhost:6001 route=node1
BalancerMember http://localhost:6002 route=node2
ProxySet stickysession=ROUTEID
ProxyPass /context balancer://cluster/context
ProxyPassReverse /context balancer://cluster2/context
--start apache
#/u01/apache/bin/apachectl start
--stop apache
#/u01/apache/bin/apachectl stop
Subscribe to:
Posts (Atom)