{"id":2566,"date":"2018-07-10T10:43:21","date_gmt":"2018-07-10T07:43:21","guid":{"rendered":"https:\/\/www.fatihacar.com\/blog\/?p=2566"},"modified":"2018-07-10T10:58:19","modified_gmt":"2018-07-10T07:58:19","slug":"automatic-virtual-ip-creation-with-linux-service-in-centos-7","status":"publish","type":"post","link":"http:\/\/www.fatihacar.com\/blog\/automatic-virtual-ip-creation-with-linux-service-in-centos-7\/","title":{"rendered":"Virtual IP Creation with Linux Service in CentOS 7"},"content":{"rendered":"<p>You can create virtual IP address with linux service. I designed the linux service to create a virtual IP address when operating system is rebooted.<\/p>\n<p><strong>My System Properties<\/strong><\/p>\n<p><strong>Ethernet Adaptor Name : <\/strong>ens14025<br \/>\n<strong>Virtual IP : <\/strong>192.168.44.55<\/p>\n<p><strong>1. Create Bash Script To Create Virtual IP Address<\/strong><\/p>\n<blockquote>\n<pre><code>\r\n[root@test ~]# vi \/opt\/scripts\/virtual_ip_up.sh\r\n\r\n#!\/bin\/bash\r\nifconfig ens14025:1 192.168.44.55 netmask 255.255.255.0\r\n\r\n[root@test ~]# chmod 744 \/opt\/scripts\/virtual_ip_up.sh\r\n<\/code><\/pre>\n<\/blockquote>\n<p><strong>2. Create Service File <\/strong><\/p>\n<blockquote>\n<pre><code>\r\n[root@test ~]# vi \/etc\/systemd\/system\/virtual_ip.service\r\n\r\n[Unit]\r\nDescription=Virtual IP\r\nAfter=syslog.target\r\nAfter=network.target\r\n\r\n[Service]\r\nType=simple\r\n\r\nUser=root\r\nGroup=root\r\n\r\nOOMScoreAdjust=-1000\r\n\r\nExecStart=\/opt\/scripts\/virtual_ip_up.sh\r\n\r\nTimeoutSec=300\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n\r\n\r\n[root@test ~]# chmod 644 \/etc\/systemd\/system\/virtual_ip.service\r\n<\/code><\/pre>\n<\/blockquote>\n<p><strong>3. Start Service<\/strong><\/p>\n<blockquote>\n<pre><code>\r\n\r\n[root@test ~]# systemctl daemon-reload\r\n[root@test ~]# systemctl start virtual_ip.service\r\n[root@test ~]# systemctl enable virtual_ip.service\r\n\r\n<\/code><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>You can create virtual IP address with linux service. I designed the linux service to create a virtual IP address when operating system is rebooted. My System Properties Ethernet Adaptor Name : ens14025 Virtual IP : 192.168.44.55 1. Create Bash Script To Create Virtual IP Address [root@test ~]# vi \/opt\/scripts\/virtual_ip_up.sh #!\/bin\/bash ifconfig ens14025:1 192.168.44.55 netmask&#8230;<\/p>\n","protected":false},"author":37,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[18],"tags":[15,31,22],"class_list":["post-2566","post","type-post","status-publish","format-standard","hentry","category-linux-unix","tag-linux","tag-linux-administration","tag-system-administration"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p39NFI-Fo","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/users\/37"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/comments?post=2566"}],"version-history":[{"count":4,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2566\/revisions"}],"predecessor-version":[{"id":2570,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/posts\/2566\/revisions\/2570"}],"wp:attachment":[{"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/media?parent=2566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/categories?post=2566"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fatihacar.com\/blog\/wp-json\/wp\/v2\/tags?post=2566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}