{"id":287,"date":"2009-02-02T17:55:15","date_gmt":"2009-02-02T14:55:15","guid":{"rendered":"http:\/\/patchlog.com\/?p=287"},"modified":"2009-02-01T17:56:42","modified_gmt":"2009-02-01T14:56:42","slug":"ip-alias-dhcp-ubuntu","status":"publish","type":"post","link":"https:\/\/patchlog.com\/linux\/ip-alias-dhcp-ubuntu\/","title":{"rendered":"Ip alias with dhcp in ubuntu"},"content":{"rendered":"<h2>Problem<\/h2>\n<p>You have a machine running ubuntu, NetworkManager gets the ip from a dhcp server and you want to have another ip that never changes on the same interface (for example if you want to also act as a dhcp server for your local network and both the local and uplink are connected on the same interface).<\/p>\n<p>Dhclient seems to support this through an \"alias\" statement and NetworkManager seems to use dhclient but I just couldn't make it work like this.<\/p>\n<h2>Solution<\/h2>\n<p>Create a script in \/etc\/network\/if-up.d\/ . Name is as\u00c2\u00a0 you wish. My choice was \"alias\" . <\/p>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>Then make sure the script is executable: <\/p>\n<pre><ol><li style=\"font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;\"><div style=\"font-family: 'Courier New', Courier, monospace; font-weight: normal;\">&nbsp;<\/div><\/li><\/ol><\/pre>\n<p>You can replace the ip and mask to fit your needs.<br \/>\nNetworkManager will run this script automatically after it brings the interface up. <\/p>\n<p>This worked for me but in the spirit of usability it would have been nice to have this kind of feature directly into NetworkManager's connection configuration gui. <\/p>\n<p>Do you know any other way of doing this? Please share it in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem You have a machine running ubuntu, NetworkManager gets the ip from a dhcp server and you want to have another ip that never changes on the same interface (for example if you want to also act as a dhcp server for your local network and both the local and uplink are connected on the &hellip; <a href=\"https:\/\/patchlog.com\/linux\/ip-alias-dhcp-ubuntu\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Ip alias with dhcp in ubuntu<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[2],"tags":[231,232,223,230,53],"class_list":["post-287","post","type-post","status-publish","format-standard","hentry","category-linux","tag-alias","tag-dhcp","tag-ip","tag-netowrkmanager","tag-ubuntu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pofPh-4D","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/287","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/comments?post=287"}],"version-history":[{"count":7,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/287\/revisions"}],"predecessor-version":[{"id":294,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/posts\/287\/revisions\/294"}],"wp:attachment":[{"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/media?parent=287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/categories?post=287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patchlog.com\/wp-json\/wp\/v2\/tags?post=287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}