How can I add a sub-interface in CentOS 7?

Linode Staff

I have an application that requires a separate interface for the public IP and the private IP however a Linode only comes with one interface. I want to try using a sub-interface but I'm not sure how to go about setting that up. I'm using CentOS 7.

1 Reply

You can create a sub-interface in CentOS7 by creating a new interface network-script. For instance, a Linode will be provisioned with the interface "eth0" automatically, to create the sub-interface "eth0:1" you would need to create the script file "ifcfg-eth0:1" in the network-scripts directory:


Once you've created that file you'll need to provision it with the correct parameters. Using the example address with the default-gateway the file would need to be configured like this:








Save the changes and then make sure that the Network Helper feature is turned off (if not it will rewrite your interface file changes):

Auto-configure Networking

You can then reboot the Linode and the sub-interface will be provisioned with the IP specified in the network-script configuration.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct