{"id":5489,"date":"2023-11-20T08:27:06","date_gmt":"2023-11-20T08:27:06","guid":{"rendered":"https:\/\/natsav.com\/blog\/?p=5489"},"modified":"2024-02-03T12:42:49","modified_gmt":"2024-02-03T12:42:49","slug":"add-additional-ip-on-centos-7","status":"publish","type":"post","link":"https:\/\/natsav.com\/blog\/add-additional-ip-on-centos-7\/","title":{"rendered":"How to Add an Additional IP in Centos 7."},"content":{"rendered":"<p># To add an additional IP address in CentOS 7, you can use the &#8216;ifcfg&#8217; files in the &#8216;\/etc\/sysconfig\/network-scripts\/&#8217; directory. Here are the steps:-<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Step 1: Navigate to the network scripts directory.<\/strong><\/span><br \/>\n# [ cd \/etc\/sysconfig\/network-scripts\/ ]<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Step 2: Create a new ifcfg file for the additional IP.<\/strong><\/span><br \/>\nYou can copy the existing ifcfg file for your network interface and modify it for the new IP. For example, if your network interface is &#8216;eth0&#8217;, you can create a new file named &#8216;ifcfg-eth0:1&#8217; for the additional IP:-<br \/>\n# [ cp ifcfg-eth0 ifcfg-eth0:1 ]<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Step 3: Edit the new ifcfg file.<\/strong><\/span><br \/>\na).\u00a0 Use a text editor to open the newly created file. For example, you can use &#8216;nano&#8217; or &#8216;vi&#8217;.<br \/>\n[ nano ifcfg-eth0:1 ]<br \/>\nb). Modify the file to include the new IP address. Here&#8217;s an example of what the file might look like:-<br \/>\nTYPE=Ethernet<br \/>\nBOOTPROTO=none<br \/>\nDEFROUTE=yes<br \/>\nNAME=eth0:1<br \/>\nDEVICE=eth0:1<br \/>\nONBOOT=yes<br \/>\nIPADDR=your_additional_ip<br \/>\nNETMASK=your_subnet_mask<br \/>\nc). Make sure to replace &#8216;your_additional_ip&#8217; and &#8216;your_subnet_mask&#8217; with the actual values for the additional IP address and subnet mask you want to add.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong><span style=\"color: #000000; text-decoration: underline;\">Step 4:Restart the network service.<\/span><br \/>\n<\/strong><\/span>After making the changes, you need to restart the network service for the changes to take effect.<br \/>\n# [ systemctl restart network ]<\/p>\n<p><span style=\"text-decoration: underline;\"><strong><span style=\"color: #000000; text-decoration: underline;\">Step 5: Verify the new IP.<\/span><br \/>\n<\/strong><\/span>a). You can use the &#8216;ip addr&#8217; command to verify that the new IP address has been added.<br \/>\nb). Look for the interface (&#8216;eth0:1&#8217; in this example) and check if the new IP address is listed.<\/p>\n<p><span style=\"text-decoration: underline; color: #000000;\"><strong>Note:<\/strong><\/span> these changes will not persist after a system reboot unless you configure them to do so. If you want the additional IP to be automatically added at startup, make sure the &#8216;ONBOOT&#8217; parameter in the ifcfg file is set to &#8216;yes&#8217;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p># To add an additional IP address in CentOS 7, you can use the &#8216;ifcfg&#8217; files in the &#8216;\/etc\/sysconfig\/network-scripts\/&#8217; directory. Here are the steps:- Step 1: Navigate to the network scripts directory. # [ cd \/etc\/sysconfig\/network-scripts\/ ] Step 2: Create a new ifcfg file for the additional IP. You can copy the existing ifcfg file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5505,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[256],"tags":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/natsav.com\/blog\/wp-content\/uploads\/2023\/11\/IP-4-e1700479254885.jpg?fit=720%2C388&ssl=1","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5489"}],"collection":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/comments?post=5489"}],"version-history":[{"count":5,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5489\/revisions"}],"predecessor-version":[{"id":5502,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/posts\/5489\/revisions\/5502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media\/5505"}],"wp:attachment":[{"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/media?parent=5489"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/categories?post=5489"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/natsav.com\/blog\/wp-json\/wp\/v2\/tags?post=5489"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}