<?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>vm &#8211; Luxing Huang</title>
	<atom:link href="https://luxing.im/tag/vm/feed/" rel="self" type="application/rss+xml" />
	<link>https://luxing.im</link>
	<description>Thoughs and things</description>
	<lastBuildDate>Mon, 20 Jul 2020 03:38:47 +0000</lastBuildDate>
	<language>en-CA</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
<site xmlns="com-wordpress:feed-additions:1">58771605</site>	<item>
		<title>Make virtual ethernet the default</title>
		<link>https://luxing.im/make-virtual-ethernet-the-default/</link>
					<comments>https://luxing.im/make-virtual-ethernet-the-default/#respond</comments>
		
		<dc:creator><![CDATA[Luxing Huang]]></dc:creator>
		<pubDate>Mon, 20 Jul 2020 03:34:52 +0000</pubDate>
				<category><![CDATA[Learning Notes]]></category>
		<category><![CDATA[Techie Stuff]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[vm]]></category>
		<guid isPermaLink="false">https://luxing.im/?p=845</guid>

					<description><![CDATA[Recently I leased a server with 2 IPs, x.x.x.x and y.y.y.y from a VPS company. Their first IP is the primary one and is connected to my VM, the secondary IP y.y.y.y is there for me to use, but have not connected yet. Given the following status quo: The primary x.x.x.x is a great IP &#8230; <p class="link-more"><a href="https://luxing.im/make-virtual-ethernet-the-default/" class="more-link">Continue reading<span class="screen-reader-text"> "Make virtual ethernet the default"</span></a></p>]]></description>
										<content:encoded><![CDATA[<p>Recently I leased a server with 2 IPs, x.x.x.x and y.y.y.y from a VPS company. Their first IP is the primary one and is connected to my VM, the secondary IP y.y.y.y is there for me to use, but have not connected yet.</p>
<p><span id="more-845"></span><br />
Given the following status quo:</p>
<p>The primary x.x.x.x is a great IP and has good connectivity all over the world, however their y.y.y.y secondary IP has a premium networking route to certain places in the world in addition. I&#8217;d like to have both IP working in the mean time make y.y.y.y the default IP. My operating system is CentOS 7.</p>
<p>I would like to achieve the goal of:<br />
1. Add y.y.y.y to the system<br />
2. Make y.y.y.y the default IP, if seen from outside world.<br />
3. Keep the primary x.x.x.x IP available and connected just in case for failover.</p>
<p>So here is how I did it:</p>
<ol>
<li>Copy from ifcfg-eth0 to ifcfg-eth0:1 and change ifcfg-eth0:1 file in /etc/sysconfig/network-scripts</li>
<pre>
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0:1
GATEWAY=y.y.y.1
HWADDR=be:ef:be:ef:be:ef
IPADDR=y.y.y.y
IPV6INIT=no
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
</pre>
<p>Here BOOTPROTO must be none, make sure you keep the MAC address the same as ifcfg-eth0 and replace the values I obfuscated.</p>
<li>Modify ifcfg-eth0 file with DEFROUTE=no</li>
<li>Add a static route to make sure. Create a file route-eth0 in /etc/sysconfig/network-scripts</li>
<pre>
default via y.y.y.1 dev eth0:1
</pre>
<li>Restart network service</li>
<pre>systemctl restart network</pre>
<li>Confirm your IP and route</li>
<pre>
# confirm IP:
ip a

# confirm route:
ip ro
</pre>
</ol>
<p>And your VM&#8217;s default IP to the outside world should be y.y.y.y now.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://luxing.im/make-virtual-ethernet-the-default/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">845</post-id>	</item>
	</channel>
</rss>
