<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hack Admin &#187; TCP/IP</title>
	<atom:link href="http://www.hackadmin.com/category/tcpip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IP Failover For Web Cluster</title>
		<link>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/</link>
		<comments>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:38:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=258</guid>
		<description><![CDATA[keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>keepalived provides a strong and robust health checking for LVS clusters. It nginx implements a framework of health checking on multiple layers for server failover, and VRRPv2 stack to handle director failover. How do I install and configure Keepalived for reverse proxy server such as nginx or lighttpd?</p>
<p><span id="more-258"></span><br />
If your are using a LVS director to loadbalance a server pool in a production environment, you may want to have a robust solution for healthcheck &amp; failover. This will also work with reverse proxy server such as nginx.</p>
<p>lb0 &#8211; Linux box directly connected to the Internet via eth1. This is master load balancer.<br />
lb1 &#8211; Linux box directly connected to the Internet via eth1. This is backup load balancer. This will become active if master networking failed.</p>
<p>202.54.1.1 &#8211; This ip moves between lb0 and lb1 server. It is called virtual IP address and it is managed by keepalived.<br />
eth0 is connected to LAN and all other backend software such as Apache, MySQL and so on.</p>
<p><strong>You need to install the following softwares on both lb0 and lb1:<br />
</strong><br />
keepalived for IP failover.<br />
iptables to filter traffic<br />
nginx or lighttpd revers proxy server.</p>
<p><strong>DNS settings should be as follows:</strong></p>
<p><a href="http://hackadmin.in/" target="_blank">hackadmin.in</a> &#8211; Our sample domain name.<br />
<a href="http://lb0.hackadmin.in/" target="_blank">lb0.hackadmin.in</a> &#8211; 202.54.1.11 (real ip assigned to eth1)<br />
<a href="http://lb1.hackadmin.in/" target="_blank">lb1.hackadmin.in</a> &#8211; 202.54.1.12 (real ip assigned to eth1)<br />
<a href="../" target="_blank">www.hackadmin.com</a> &#8211; 202.54.1.1 (VIP for web server) do not assign this IP to any interface.</p>
<p><strong>Install Keepalived</strong></p>
<p>Visit <a href="http://keepalived.org/" target="_blank">keepalived.org</a> to grab latest source code. You can use the wget command to download the same (you need to install keepalived on both lb0 and lb1):</p>
<p># cd /opt</p>
<p># wget <a href="http://www.keepalived.org/software/keepalived-1.1.19.tar.gz" target="_blank">http://www.keepalived.org/software/keepalived-1.1.19.tar.gz</a></p>
<p>#  tar -zxvf keepalived-1.1.19.tar.gz</p>
<p># cd keepalived-1.1.19</p>
<p><strong>Install Kernel Headers</strong></p>
<p>You need to install the following packages:</p>
<p>Kernel-headers &#8211; includes the C header files that specify the interface between the Linux kernel and userspace libraries and programs. The header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package.<br />
kernel-devel &#8211; this package provides kernel headers and makefiles sufficient to build modules against the kernel package.</p>
<p>Make sure kernel-headers and kernel-devel packages are installed. If not type the following install the same:<br />
<strong><br />
Compile keepalived</strong></p>
<p><strong>Type the following command:</strong><br />
# ./configure &#8211;with-kernel-dir=/lib/</p>
<div id=":1j0">modules/$(uname -r)/build</p>
<p>Sample outputs:</p>
<p>checking for gcc&#8230; gcc<br />
checking for C compiler default output file name&#8230; a.out<br />
checking whether the C compiler works&#8230; yes<br />
checking whether we are cross compiling&#8230; no<br />
checking for suffix of executables&#8230;<br />
checking for suffix of object files&#8230; o<br />
&#8230;<br />
&#8230;..<br />
..<br />
config.status: creating keepalived/check/Makefile<br />
config.status: creating keepalived/libipvs-2.6/Makefile</p>
<p><strong>Keepalived configuration</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Keepalived version       : 1.1.19<br />
Compiler                 : gcc<br />
Compiler flags           : -g -O2<br />
Extra Lib                : -lpopt -lssl -lcrypto<br />
Use IPVS Framework       : Yes<br />
IPVS sync daemon support : Yes<br />
Use VRRP Framework       : Yes<br />
Use Debug flags          : No</p>
<p><strong>Compile and install the same:</strong><br />
# make &amp;&amp; make install</p>
<p><strong>Create Required Softlinks</strong></p>
<p>Type the following commands to create service and run it at RHEL / CentOS run level #3 :<br />
# cd /etc/sysconfig<br />
# ln -s /usr/local/etc/sysconfig/keepalived .<br />
# cd /etc/rc3.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived S100keepalived<br />
# cd /etc/init.d/<br />
# ln -s /usr/local/etc/rc.d/init.d/keepalived .<br />
<strong><br />
Configuration</strong></p>
<p>Your main configuration directory is located at /usr/local/etc/keepalived and configuration file name is keepalived.conf. First, make backup of existing configuration:<br />
# cd /usr/local/etc/keepalived<br />
# cp keepalived.conf keepalived.conf.bak<br />
Edit keepalived.conf as follows on lb0:</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 101<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Edit keepalived.conf as follows on lb1 (note priority set to 100 i.e. backup load balancer):</p>
<p>vrrp_instance VI_1 {<br />
interface eth0<br />
state MASTER<br />
virtual_router_id 51<br />
priority 100<br />
authentication {<br />
auth_type PASS<br />
auth_pass Add-Your-Password-Here<br />
}<br />
virtual_ipaddress {<br />
<a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> dev eth1<br />
}<br />
}</p>
<p>Save and close the file. Finally start keepalived on both lb0 and lb1 as follows:<br />
# /etc/init.d/keepalived start</p>
<p>Verify: Keepalived Working Or Not</p>
<p>/var/log/messages will keep track of VIP:<br />
# tail -f /var/log/messages<br />
Sample outputs:</p>
<p>Feb 21 04:06:15 lb0 Keepalived_vrrp: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:06:20 lb0 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p>
<p>Verify that VIP assigned to eth1:<br />
# ip addr show eth1<br />
<strong>Sample outputs:</strong></p>
<p>3: eth1:  mtu 1500 qdisc pfifo_fast qlen 10000<br />
link/ether 00:30:48:30:30:a3 brd ff:ff:ff:ff:ff:ff<br />
inet <a href="http://202.54.1.11/29" target="_blank">202.54.1.11/29</a> brd 202.54.1.254 scope global eth1<br />
inet <a href="http://202.54.1.1/29" target="_blank">202.54.1.1/29</a> scope global secondary eth1</p>
<p><strong>ping failover test</strong></p>
<p>Open UNIX / Linux / OS X desktop terminal and type the following command to ping to VIP:<br />
# ping 202.54.1.1<br />
Login to lb0 and halt the server or take down networking:<br />
# halt<br />
Within seconds VIP should move from lb0 to lb1 and you should not see any drops in ping. On lb1 you should get the following in /var/log/messages:</p>
<p>Feb 21 04:10:07 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) forcing a new MASTER election<br />
Feb 21 04:10:08 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Transition to MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Entering MASTER STATE<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) setting protocol VIPs.<br />
Feb 21 04:10:09 lb1 Keepalived_healthcheckers: Netlink reflector reports IP 202.54.1.1 added<br />
Feb 21 04:10:09 lb1 Keepalived_vrrp: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 202.54.1.1</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/22/ip-failover-for-web-cluster/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>Port Redirection through the iptables</title>
		<link>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 03:44:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=254</guid>
		<description><![CDATA[How do I redirect 80 port to 8123 using iptables?

You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong> </strong>How do I redirect 80 port to 8123 using iptables?</p>
<p>You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.</p>
<p><span id="more-254"></span><br />
<strong>Syntax<br />
</strong><br />
The syntax is as follows to redirect tcp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumbe</p>
<p>The syntax is as follows to redirect udp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p udp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumber</p>
<p>Replace eth0 with your actual interface name. The following syntax match for source and destination ips:</p>
<p>iptables -t nat -I PREROUTING &#8211;src $SRC_IP_MASK &#8211;dst $DST_IP -p tcp &#8211;dport $portNumber -j REDIRECT &#8211;to-ports $rediectPort</p>
<p><strong>Examples:</strong></p>
<p>In The following example redirects TCP port 25 to port 2525:</p>
<p># iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport 25 -j REDIRECT &#8211;to-port 2525</p>
<p>this example all incoming traffic on port 80 redirect to port 8123</p>
<p># iptables -t nat -I PREROUTING &#8211;src 0/0 &#8211;dst 192.168.1.5 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-ports 8123</p>
<p><strong>How Do I View NAT Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables -t nat -L -n -v</p>
<p><strong>How Do I Save NAT Redirect Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables-save</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>How to Create Connection Limits with Iptables</title>
		<link>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:21:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=243</guid>
		<description><![CDATA[How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?

You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><span style="font-size: medium;"><strong></strong></span></span></p>
<p>How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?</p>
<p>You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.</p>
<p><span id="more-243"></span><br />
<strong>Syntax</strong><br />
The syntax is as follows:</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport $port -m connlimit &#8211;connlimit-above N -j REJECT &#8211;reject-with tcp-reset</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit SSH Connections Per IP / Host</p>
<p>Only allow 3 ssh connections per client host:</p>
<p># /sbin/iptables  -A INPUT -p tcp &#8211;syn &#8211;dport 22 -m connlimit &#8211;connlimit-above 3 -j REJECT</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit HTTP Connections Per IP / Host</p>
<p>Only allow 20 http connections per IP (MaxClients is set to 60 in httpd.conf):</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -m connlimit &#8211;connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset<br />
save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Skip proxy server IP 1.2.3.4 from this kind of limitations:</strong></p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -d ! 1.2.3.4 -m connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset</p>
<p>Enjoy it&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>OpenVPN Tutorial</title>
		<link>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/</link>
		<comments>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 00:42:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=236</guid>
		<description><![CDATA[Openvpn is an open source software, allows us to create a Virtual Private Network.

1. Istalling openvpn

	install these packages openvpn openssh-server openssl:

	laptop:~$ sudo apt-get install openvpn openssh-server openssl
]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>Openvpn is an open source software, allows us to create a Virtual Private Network.</p>
<p><span id="more-236"></span><br />
1. Installing openvpn</p>
<p>	install these packages openvpn openssh-server openssl:</p>
<p>	laptop:~$ sudo apt-get install openvpn openssh-server openssl</p>
<p>	Now the ssh server is installed we can control it and access to it from anywhere on the web using the IP and port 22.</p>
<p>	In reality 22 is for SSH The best port for OpenVPN (http://www.iana.org/assignments/port-numbers) is 1194.</p>
<p>	There is special web interfaces to can interact and configure openVPN through a browser like webmin, </p>
<p>	so we should install apache, php and mysql with this command:</p>
<p>	laptop:~$ sudo apt-get install apache2 mysql-server-5.0 libapache2-mod-php5 php5 php5-common php5-mysql</p>
<p>	To install webmin:</p>
<p>	laptop:~$ sudo apt-get install webmin</p>
<p>2. VPN configuration:</p>
<p>	The openvpn use Private Key Infrastructure (PKI):</p>
<p>		1. One Public key for server and Private keys for each client.</p>
<p>		2. It uses Certification for more security each Certification is valid for one couple (Server, Client)</p>
<p>	The authentication With OpenVPN is a bidirectional, means the sever identify the client before trusting on and client identify the server too.</p>
<p>	Key Generation:</p>
<p>	To generate a Key we can use scripts provided by OpenVPN</p>
<p>	We create openvpn/ in /home to manipulate and create keys there:</p>
<p>	laptop:~$ sudo cp /usr/share/doc/openvpn/examples/easy-rsa /home/openvpn/ -R</p>
<p>	All commands are in /home/openvpn/2.0/ file</p>
<p>	laptop:~$ cd /home/openvpn/2.0</p>
<p>	Edit vars file:	</p>
<p>	laptop:~$ sudo nano vars    &#8212;&#8212;&#8212;&#8212;&#8211;// (nano is a text editor you can use others: gedit, &#8230;)</p>
<p>		Setup these variables KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL</p>
<p>		EX:</p>
<p>			export KEY_COUNTRY=DZ</p>
<p>			export KEY_PROVINCE=ALGER</p>
<p>			export KEY_CITY=alger</p>
<p>			export KEY_ORG=alger</p>
<p>			export KEY_EMAIL=xxxxxxxxx@xxx.dz</p>
<p>		* We can find other variables like:</p>
<p>			 * KEY_SIZE by default set to 1024 in some countries there is limit that you</p>
<p>			     should respect for this KEY_SIZE you can&#8217;t go over the limitation.</p>
<p>			* CA_EXPIRE : In how many days your certification will expire?</p>
<p>	Save and close (in nano ctrl+x)</p>
<p>	To set these variables we run this:</p>
<p>	laptop:~$ . ./vars  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;     //first dot isn&#8217;t a mistake</p>
<p>	We should clean all existing certification we have to not have conflits (run this command):</p>
<p>	laptop:~$ sudo ./clean-all &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-// will delete /home/openvpn/2.0/keys</p>
<p>	If you do&#8217;nt have certification set before nothing will be done.</p>
<p>	Now we create our Certification and key with CA (master Certification Authority) with this command:</p>
<p>	laptop:~$ sudo ./build-ca</p>
<p>	The certification now are created in keys directory: ca.crt ca.key</p>
<p>	Generate a certification and key to the SERVER:</p>
<p>	laptop:~$ sudo ./build-key-server SERVER &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-  //we suppose that server&#8217;s named SERVER</p>
<p>	When common name is required type the name OS the server (here SERVER)</p>
<p>	Generate certification and key for client:</p>
<p>	laptop:~$ sudo ./build-key client1</p>
<p>	when common name is required type the name of the client (client1)</p>
<p>	this common name MUST be different if you have many clients.</p>
<p>	To protect your key with a password use ./build-key-pass instead of ./build-key</p>
<p>	NB: We were able to generate the client key on its own end to avoid transfer through the network</p>
<p>	Diffie Hellman parameters should be generated for the openvpn server: </p>
<p>	laptop:~$ sudo ./build-dh</p>
<p>	these parameters are copied in keys directory dh1024.pem</p>
<p>	So now all Certifications and keys are in /home/openvpn/2.0/keys directory:</p>
<p>		name 	 	Utile for					Role					Secret</p>
<p>		ca.crt 		servers and all clients 		root Certification CA 		no</p>
<p>		ca.key 		key signing the machine (both) 	root key CA 			yes</p>
<p>		dh1024.pem 	server	 				Diffie Hellman parameters	no</p>
<p>		SERVER.crt 	server					server certification 		no</p>
<p>		SERVER.key 	server		 			server key 			yes</p>
<p>		client1.crt 	Client1					Client1 certification 		no</p>
<p>		client1.key 	Client1					Client1 key 			yes</p>
<p>	We copy files to the client machines using a secured tunel</p>
<p>3. Creation of the file configuration for clients and server</p>
<p>	There is samples of this configuration in /usr/share/doc/openvpn/examples/sample-config-files/   client.conf and server.conf.gz</p>
<p>	1. Server configuration:</p>
<p>		We should gunzip the server.conf.gz</p>
<p>		laptop:~$ sudo gunzip server.conf.gz</p>
<p>		and then copy this file to /home/openvpn using:</p>
<p>		laptop:~$ sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf /etc/openvpn/</p>
<p>		Edit server.conf:</p>
<p>		laptop:~$ sudo nano /home/openvpn/server.conf</p>
<p>		this would create a VPN with virtual interface and listen to the connections in 1194 port and distribute</p>
<p>		virtual addresses to clients that connect through 10.8.0.0/24</p>
<p>		By default this server.conf is useful but we can set more parameters(directives) like (IP, PORT, KEY_SIZE etc&#8230;)</p>
<p>		Client configuration and server one must be coherent.</p>
<p>	1. Client configuration:</p>
<p>		Edit the client.conf:</p>
<p>		laptop:~$ sudo nano /home/openvpn/client.conf</p>
<p>		Verify the name of certification and key of each client:</p>
<p>		ca ca.crt</p>
<p>		cert client.crt</p>
<p>		key client.key </p>
<p>		Go to the remote parameter and set up the server IP</p>
<p>		remote my-server-1 1194</p>
<p>		save the file</p>
<p>		Now we verify if client parameters if they correspond to the server one:</p>
<p>		dev (tun ou tap)</p>
<p>		proto (udp ou tcp)</p>
<p>		comp-lzo</p>
<p>		fragment</p>
<p>4. Starting the VPN:</p>
<p>	4.1. Before we start we should copy all file in keys directory and .conf to /etc/openvpn:</p>
<p>		4.1.1 SERVER:</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/SERVER.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/SERVER.key /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/dh1024.pem /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/server.conf /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/ca.crt /etc/openvpn</p>
<p>		4.1.2 Client:</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/client1.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/client1.key /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/keys/ca.crt /etc/openvpn</p>
<p>			laptop:~$ sudo cp /home/openvpn/client1.conf /etc/openvpn</p>
<p>	4.2 Start the server:</p>
<p>		laptop:~$ cd /etc/openvpn</p>
<p>		laptop:/etc/openvpn$ sudo openvpn server.conf</p>
<p>	4.3 Start the client1:</p>
<p>		aptop:~$ cd /etc/openvpn</p>
<p>		laptop:/etc/openvpn$ sudo openvpn client1.conf</p>
<p>	4.4 Test the VPN:</p>
<p>		From the client terminal try to ping the server which has the 10.8.0.1 by default:</p>
<p>		ping 10.8.0.1</p>
<p>To can communicate with other client through the network with the VPN you have to uncomment the client-to-client parameter in server.conf<br />
 and then you would be able to ping the other clients.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/17/openvpn-tutorial/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Adding IP Addresses to Ubuntu -via Khaled</title>
		<link>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/</link>
		<comments>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 17:36:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Khaled]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual_Interface]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=191</guid>
		<description><![CDATA[1. Setup More than one IP address for one network interface:

The file which contains descriptions of the network interfaces on Ubuntu or debian is /etc/nework/interfaces
A network interface (material) by default is referenced by eth0 so if you have more than one it would be eth1 eth2, ]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/khaled/">Khaled</a></p>
<p>1. Setup More than one IP address for one network interface:</p>
<p>The file which contains descriptions of the network interfaces on Ubuntu or debian is /etc/nework/interfaces<br />
A network interface (material) by default is referenced by eth0 so if you have more than one it would be eth1 eth2,<br />
etc&#8230; so to setup a virtual ip we should create a virtual network interface, the name of this one would be as follows<br />
eth0:1, eth0:2 etc&#8230; to create this interface we should add some lines to the<br />
/etc/network/interfaces file to discribe this interface</p>
<p><span id="more-191"></span></p>
<p>NB: modifying this file need the superuser privilages</p>
<p>laptop:/$ sudo nano /etc/network/interfaces</p>
<p>We add this lines</p>
<p>auto eth0:1  //&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-we have one eth0 and we add another virtual interface refered by :1<br />
iface eth0:1 inet static //&#8212;&#8212;-this interface would use a static IP We can use dhcp as well<br />
address 192.168.1.34   //&#8212;&#8212;&#8212; IP we want to assign<br />
netmask 255.255.255.0  //&#8212;&#8212;&#8212; The netmask IP<br />
broadcast 192.168.1.255 //&#8212;&#8212;&#8211; Broadcast IP<br />
gateway 192.168.1.1     //&#8212;&#8212;&#8211; Gateway (router or&#8230;)</p>
<p>Save the file</p>
<p>As you can see this is a simple text file, so right now the network interface isn&#8217;t set yet because this<br />
configuration isn&#8217;t applied</p>
<p>To set it we should restart our network interface by using this command with superuser privilages:</p>
<p>laptop:/$ sudo /etc/init.d/networking restart</p>
<p>Your interface is set</p>
<p>To verify if it works you can ping the address you assigned by useing this command</p>
<p>laptop:/$ ping [IP_you_assigned]</p>
<p>_______________________________________________________________________________________</p>
<p>2. There is a second method we can use is not permanent which means if you restart your machine or your interface<br />
it would be deleted.</p>
<p>To do it we have to use the binary file /sbin/ip</p>
<p>To add a virtual IP we use this command:</p>
<p>laptop:/$ sudo /sbin/ip addr add [IP_you_want_to_add]/24 dev eth0</p>
<p>Here we don&#8217;t need to restart our network interface cause it&#8217;s not a simple file it a binary file it&#8217;s applied by<br />
this command.</p>
<p>To check that your change works you can ping the new address using this command:</p>
<p>laptop:/$ sudo ping [IP_address_you_added]</p>
<p>You can also verify the new IP has been added by using the ifconfig command as shown below:</p>
<p>laptop:/$ ifconfig eth0:1<br />
eth0:1    Link encap:Ethernet  HWaddr 00:26:b9:11:34:16<br />
          inet addr:192.168.3.22  Bcast:192.168.3.255  Mask:255.255.255.0<br />
          UP BROADCAST MULTICAST  MTU:1500  Metric:1<br />
          Interrupt:19 Base address:0xa000 </p>
<p>This will show you that the address you assigned is actually on the correct interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/12/adding-ip-addresses-to-ubuntu-via-medi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

