<?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>ip &#8211; VeriTeknik</title>
	<atom:link href="https://www.veriteknik.net.tr/en/tag/ip/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.veriteknik.net.tr/en/</link>
	<description>VeriTeknik Bilişim &#124; VeriTeknik Bilişim</description>
	<lastBuildDate>Wed, 11 Dec 2013 10:46:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Add Multiple Gateways to Multiple NICs on Ubuntu Server</title>
		<link>https://www.veriteknik.net.tr/en/add-multiple-gateways-multiple-nics-ubuntu-server/</link>
					<comments>https://www.veriteknik.net.tr/en/add-multiple-gateways-multiple-nics-ubuntu-server/#respond</comments>
		
		<dc:creator><![CDATA[Mustafa Emre Aydın]]></dc:creator>
		<pubDate>Wed, 11 Dec 2013 10:46:32 +0000</pubDate>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ubuntu]]></category>
		<guid isPermaLink="false">http://www.plugged.in/?p=924</guid>

					<description><![CDATA[<p>Even though this seems an easy task, when you add IP&#8217;s with different gateways, you have to route the IP&#8217;s for the correct gateways. Let&#8217;s say you have two networks, 192.168.80.128/25 192.168.90.128/25 This means your gateways are 192.168.80.129, 192.168.90.129 and you have these IP addresses respectively : 192.168.80.130-254, 192.168.90.130-254 Lets assign the 192.168.80.x IP&#8217;s to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/add-multiple-gateways-multiple-nics-ubuntu-server/">Add Multiple Gateways to Multiple NICs on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Even though this seems an easy task, when you add IP&#8217;s with different gateways, you have to route the IP&#8217;s for the correct gateways.</p>
<p>Let&#8217;s say you have two networks,<br />
192.168.80.128/25<br />
192.168.90.128/25</p>
<p>This means your gateways are 192.168.80.129, 192.168.90.129 and you have these IP addresses respectively : 192.168.80.130-254, 192.168.90.130-254</p>
<p>Lets assign the 192.168.80.x IP&#8217;s to eth0 and 90.x to eth1.<br />
Then we&#8217;ll have to edit our <strong>/etc/network/interfaces</strong> file accordingly:</p>
<pre class="brush: text; gutter: true; first-line: 1">auto lo
iface lo inet loopback

auto eth0 eth0:1 eth1 eth1:1

iface eth0 inet static
    address 192.168.80.130
    netmask 255.255.255.128
    gateway 192.168.80.129

iface eth0:1 inet static
    address 192.168.80.131
    netmask 255.255.255.128

iface eth1 inet static
    address 192.168.90.130
    netmask 255.255.255.128

iface eth1:1 inet static
    address 192.168.90.131
    netmask 255.255.255.128

post-up ip route add default via 192.168.90.129 dev eth1 table 101</pre>
<p>As you can see, we did not specify any gateways for other devices than eth0. This is because, we will route the 192.168.90.x IP addresses through 192.168.90.129 but the system will not know it as a default gateway. That&#8217;s why we added the last line to interfaces, we tell to route 192.168.90.129 using table 101. Well, you&#8217;ll say <em>&#8220;We haven&#8217;t defined that table yet, what&#8217;s this 101?&#8221;</em>, that&#8217;s true, normally you have to define it in your shell, but we&#8217;ll add it to our rc.local so that it will be there all the time (after a reboot).</p>
<p>In order to achieve this, we add the following line to <strong>/etc/rc.local</strong> (add it before the &#8220;exit 0&#8221;)</p>
<pre class="brush: text; gutter: true; first-line: 1">ip rule add from 192.168.90.128/25 lookup 101</pre>
<p>Now write the ip rule to your shell too (so you won&#8217;t need a reboot) then restart your networking service.</p>
<pre class="brush: bash; gutter: true; first-line: 1">/etc/init.d/networking stop &amp;&amp; /etc/init.d/networking start</pre>
<p>Here you go, <strong>route -n</strong> will show you only one gateway, yet you&#8217;ll be able to use both IP classes on both devices. So technically we did not add two gateways, but we&#8217;re using both of them.</p>
<p>Don&#8217;t forget that we only added 4 IP&#8217;s here, if you want to add all of them in the block, you better write a script to generate it.</p>
<p>Ok you don&#8217;t have to cry about it, below is a Python script I wrote for you, edit it accordingly 🙂</p>
<pre class="brush: python; gutter: true; first-line: 1">#/usr/bin/python

#ip generator script - plugged.in

IP_c1 = 80
IP_c2 = 90

print "auto lo"
print "iface lo inet loopback"

print "auto eth0"
print "iface eth0 inet static"
print "\taddress 192.168.%i.130" % IP_c1
print "\tnetmask 255.255.255.128"
print "\tgateway 192.168.%i.129" % IP_c1

print "auto %s %s" % (" ".join(["eth0:%i" % i for i in range(1,124)])," ".join(["eth1:%i" % i for i in range(1,128)]))

for c in [IP_c1,IP_c2] :
    if c == IP_c1 :
        for i in range(131,255) :
            print "iface eth0:%i inet static" % (i-130)
            print "\taddress 192.168.%i.%i" % (c,i)
            print "\tnetmask 255.255.255.128"
    else :
        for i in range(130,255) :
            print "iface eth1:%i inet static" % (i-129)
            print "\taddress 192.168.%i.%i" % (c,i)
            print "\tnetmask 255.255.255.128"

print "post-up ip route add default via 192.168.90.129 dev eth1 table 101"</pre>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/add-multiple-gateways-multiple-nics-ubuntu-server/">Add Multiple Gateways to Multiple NICs on Ubuntu Server</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.veriteknik.net.tr/en/add-multiple-gateways-multiple-nics-ubuntu-server/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">924</post-id>	</item>
		<item>
		<title>Bind Multiple IP Addresses on a Single Network Card IPv4 &#038; IPv6</title>
		<link>https://www.veriteknik.net.tr/en/bind-multiple-ip-addresses-on-a-single-network-card/</link>
					<comments>https://www.veriteknik.net.tr/en/bind-multiple-ip-addresses-on-a-single-network-card/#respond</comments>
		
		<dc:creator><![CDATA[Mustafa Emre Aydın]]></dc:creator>
		<pubDate>Wed, 02 May 2012 10:03:38 +0000</pubDate>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[ipv4]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<guid isPermaLink="false">http://www.plugged.in/?p=366</guid>

					<description><![CDATA[<p>The beauty of having multiple IP addresses on a single server is that you can run several services with different addressing. This way you can announce your FTP service on a different address and your HTTP on another. Below I&#8217;ll describe how to achieve this in Debian based and Red Hat based distros seperately. Using [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/bind-multiple-ip-addresses-on-a-single-network-card/">Bind Multiple IP Addresses on a Single Network Card IPv4 &#038; IPv6</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The beauty of having multiple IP addresses on a single server is that you can run several services with different addressing. This way you can announce your FTP service on a different address and your HTTP on another.</p>
<p>Below I&#8217;ll describe how to achieve this in Debian based and Red Hat based distros seperately.</p>
<p>Using Debian based distros (Ubuntu, Mint etc.), setting multiple IP addresses on a single network interface is simple.</p>
<p>What we will do is to edit the /etc/network/interfaces file.<br />
If you are using DHCP, then your file should look similar to this,</p>
<pre class="brush: text; gutter: true; first-line: 1">auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet dhcp
iface eth0:0 inet6 dhcp</pre>
<p>Here, the <strong>eth0:0</strong> is how we get the secondary IP address on the <strong>eth0</strong> device.</p>
<p>If you&#8217;re using a static IP address instead of DHCP, then your interfaces file should be like,</p>
<pre class="brush: text; gutter: true; first-line: 1">auto eth0
iface eth0 inet static
address 10.20.30.40
netmask 255.255.255.0
network 10.20.30.0
broadcast 10.20.30.255
gateway 10.20.30.1
dns-nameservers 8.8.8.8

iface eth0 inet6 static
address 2f00:7300:100::10
netmask 64

auto eth0:0
iface eth0:0 inet static
address 10.20.30.41
netmask 255.255.255.0

iface eth0:0 inet6 static
address 2f00:7300:100::11
netmask 64</pre>
<p>You can add as many as you want, such as <strong>eth0:1</strong>, <strong>eth0:2</strong> &#8230;</p>
<p>Sometimes when adding multiple IPv6 addresses on Debian systems, it is possible that you get an error. The current workaround for that is to enable and disable the device a couple of times. You can find the solution to that problem <a href="https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/617978" target="_blank">here</a>.</p>
<p>In Red Hat based distros (CentOS, Fedora etc.), the interfaces are edited through the directory <strong>/etc/sysconfig/network-scritps</strong>. Here we have multiple files, each pointing for a device. For instance, to have 2 additional IP&#8217;s on a single ethernet device (totaling 3 addresses) we should have 3 files as follows,</p>
<p><strong>/etc/sysconfig/network-scripts/ifcfg-eth0<br />
/etc/sysconfig/network-scripts/ifcfg-eth0:1<br />
/etc/sysconfig/network-scripts/ifcfg-eth0:2</strong></p>
<p>The main device file would be just a standard one, we don&#8217;t have to change anything with it.<br />
On the other hand, the <strong>ifcfg-eth0:1</strong> file should be similar to this,</p>
<pre class="brush: text; gutter: true; first-line: 1">NAME=""
BOOTPROTO=static
MACADDR=""
IPV6INIT=no
DEVICE=eth0:1
NETMASK=255.255.255.0
MTU=""
BROADCAST=10.20.30.255
ONPARENT=yes
IPADDR=10.20.30.41
NETWORK=10.20.30.0
IPV6INIT=yes
IPV6ADDR=2f00:7300:100::11
IPV6_DEFAULTGW=2f00:7300:100::1
ONBOOT=yes</pre>
<p>This would suffice. Don&#8217;t forget to restart your network services after adding the lines (or files) to with your appropriate settings.</p>
<p>For Debian : <strong>$ /etc/init.d/networking stop &amp;&amp; /etc/init.d/networking start</strong><br />
For Red Hat : <strong>$ service network restart</strong></p>
<p>For additional IPv6 addresses you should need to add IPV6ADDR_SECONDARIES=&#8221;&#8221; line to /etc/sysconfig/network-scripts/ifcfg-eth0 file</p>
<pre class="brush: text; gutter: true; first-line: 1">IPV6INIT=yes
IPV6ADDR=2f00:7300:1::2/64
IPV6ADDR_SECONDARIES="2f00:7300:1::3/64 2f00:7300:1::4/64 2f00:7300:1::fff4/64 2f00:7300:1::fff5/64"</pre>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/bind-multiple-ip-addresses-on-a-single-network-card/">Bind Multiple IP Addresses on a Single Network Card IPv4 &#038; IPv6</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.veriteknik.net.tr/en/bind-multiple-ip-addresses-on-a-single-network-card/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">366</post-id>	</item>
	</channel>
</rss>
