Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: to fill or not to fill interfaces

  1. #1
    Join Date
    Apr 2013
    Beans
    130
    Distro
    Ubuntu 14.04 Trusty Tahr

    to fill or not to fill interfaces

    During installation I let Ubuntu choose its way to configure Internet through a router running a DHCP server, so I'm basically getting my IP address from that router which was automatically discovered. But I recently read some docs about Networking and there was more info in a file than I actually have on my machine.

    My /etc/network/interfaces file looks like this:

    Code:
    auto lo
    iface lo inet loopback
    Plus one iptables pre-up, which I added at some point.

    Nothing about other interfaces: eth0 & wrl0 (my wireless interface). I am not using wrl0 now, but all my connections are going through eth0.

    My guess is that all interfaces info must be must be written to the interfaces file in the case of a system running server services or not running any GUI, but for a basic workstation, which uses Network Manager, adding all interfaces to the file is not compulsory. However, I'm not sure about it and I'm wondering if it is recommended or wrong to add the interfaces myself after the lo.I know how to add all interfaces and all the details, but I'm not sure if there's anything to gain or any inconvenience because of this?

  2. #2
    Join Date
    Apr 2012
    Beans
    Hidden!

    Re: to fill or not to fill interfaces

    Hi, unless you are running a server and even then
    depending on what you do with the server you dont
    need to add anythinng to your current /etc/network/interfaces
    nor do you need to add anyting to iptables. You have exactly
    what you need for a stand alone computer using wired or wireless.
    Here is mine...and i have 3 machines networked, via ssh for local
    lan use only.
    Code:
    hadaka@the-beach:~$ cat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    so you are fine, just the way you are.
    hope that helps.
    Craving anchovy, herring and squid pizza.....with clam sauce

  3. #3
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: to fill or not to fill interfaces

    Quote Originally Posted by Hadaka View Post
    Hi, unless you are running a server and even then
    depending on what you do with the server you dont
    need to add anythinng to your current /etc/network/interfaces
    nor do you need to add anyting to iptables. You have exactly
    what you need for a stand alone computer using wired or wireless.
    Here is mine...and i have 3 machines networked, via ssh for local
    lan use only.
    Code:
    hadaka@the-beach:~$ cat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    so you are fine, just the way you are.
    hope that helps.
    Agreed.

    One thing you might occasionally find in forums such as this one is people setting IP addresses in their interfaces file, and sometimes there's good reason to do so. My preference is to use my router to manage IP address allocation where possible. This can make it easier when connecting a portable device to someone else's network.
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  4. #4
    Join Date
    Apr 2013
    Beans
    130
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    Quote Originally Posted by Hadaka View Post
    Hi, unless you are running a server and even then
    depending on what you do with the server you dont
    need to add anythinng to your current /etc/network/interfaces
    nor do you need to add anyting to iptables. You have exactly
    what you need for a stand alone computer using wired or wireless.
    Here is mine...and i have 3 machines networked, via ssh for local
    lan use only.
    Code:
    hadaka@the-beach:~$ cat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    so you are fine, just the way you are.
    hope that helps.
    I'm fine, it works really great. I was just trying to understand when do I need to add interfaces.

    Thanks!

  5. #5
    Join Date
    Jan 2006
    Location
    Not heaven... Iowa
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: to fill or not to fill interfaces

    A machine without Network Manager (e.g. server) will probably use /etc/network/interfaces. DHCP or static addresses can be configured either way. Network Manager and /etc/network/interfaces do not play nicely together, so trying to referee can be tricky.
    Linux User #415691 Ubuntu User #8629
    Iowa Team (LoCo): [Wiki] [Launchpad]
    IRC channel: #ubuntu-us-ia on irc.freenode.net

  6. #6
    Join Date
    Apr 2013
    Beans
    130
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    Quote Originally Posted by Iowan View Post
    A machine without Network Manager (e.g. server) will probably use /etc/network/interfaces. DHCP or static addresses can be configured either way. Network Manager and /etc/network/interfaces do not play nicely together, so trying to referee can be tricky.
    Thank you, that answered not only the question I posted, but also a few which I also had in mind.

    First of all, I understand that the server version of Ubuntu doesn't run Network Manager. So, that machine needs to have the interfaces configured, loaded and changed in a different way.

    I guess that the word "auto" loads all interfaces (auto eth0, auto lo, auto wrl0) with the specific details mentioned afterwards (it can include different settings, DNS addresses for every interface etc).

    I think that all interfaces could be active (responsive) at a time (at least lo, eth0 & wrl0), or could be disabled individually, but the traffic won't use them all. In my case, I can activate both Wireless connection and Cable connection with NM, but it doesn't mean that I am using both at the same time to connect to my router, so only one of them can be used at a moment.

    I am not actually trying to referee a NM / etc/network/interfaces play, I'm trying to understand how things work. In case my GUI doesn't start or NM doesn't work or in case I decide to install a server edition on other computer, it's good to know how to do things and it's even better to understand them first.

  7. #7
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    Quote Originally Posted by clearski View Post
    ...

    First of all, I understand that the server version of Ubuntu doesn't run Network Manager. So, that machine needs to have the interfaces configured, loaded and changed in a different way.
    Traditionally Linux TCP/IP networking was configured with 3 files. These are: /etc/network/interfaces, /etc/resolv.conf and /etc/hosts. Later there have been apps that help in configuring the networking (i.e. WICD and Network Manager) These use different files to store the information needed. It's the same info, just stored in a different place. Either method will work. You can't configure a specific interface with both methods at the same time however.

    I guess that the word "auto" loads all interfaces (auto eth0, auto lo, auto wrl0) with the specific details mentioned afterwards (it can include different settings, DNS addresses for every interface etc).
    Yes, auto does load the configuration for a specific interface at boot time.

    I think that all interfaces could be active (responsive) at a time (at least lo, eth0 & wrl0), or could be disabled individually, but the traffic won't use them all. In my case, I can activate both Wireless connection and Cable connection with NM, but it doesn't mean that I am using both at the same time to connect to my router, so only one of them can be used at a moment.
    You can have only one interface active per subnet at any one time. The loopback adapter uses the 127.0.0.0/8 network and you can configure the eth and wlan adapters to the IP network of your choice. If you configure the eth and wlan adapters to have IP addresses in the same subnet, the eth adapter will have precedence over the wlan adapter and will therefore be active. In this scenario the wlan adapter will be configured but not active.

    I am not actually trying to referee a NM / etc/network/interfaces play, I'm trying to understand how things work. In case my GUI doesn't start or NM doesn't work or in case I decide to install a server edition on other computer, it's good to know how to do things and it's even better to understand them first.
    I don't think @iowan meant that literally. Just that NM and using the interfaces file causes conflicts as they use different methods to achive the same goal.

    FWIW -- Both methods (NM or interfaces) will configure either DHCP IP addressing configuration parameters or static (via the interfaces file) IP addressing configuration parameters.
    -BAB1

  8. #8
    Join Date
    Apr 2013
    Beans
    130
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    Quote Originally Posted by bab1 View Post
    Traditionally Linux TCP/IP networking was configured with 3 files. These are: /etc/network/interfaces, /etc/resolv.conf and /etc/hosts. Later there have been apps that help in configuring the networking (i.e. WICD and Network Manager) These use different files to store the information needed. It's the same info, just stored in a different place. Either method will work. You can't configure a specific interface with both methods at the same time however.Yes, auto does load the configuration for a specific interface at boot time.You can have only one interface active per subnet at any one time. The loopback adapter uses the 127.0.0.0/8 network and you can configure the eth and wlan adapters to the IP network of your choice. If you configure the eth and wlan adapters to have IP addresses in the same subnet, the eth adapter will have precedence over the wlan adapter and will therefore be active. In this scenario the wlan adapter will be configured but not active.
    I don't think @iowan meant that literally. Just that NM and using the interfaces file causes conflicts as they use different methods to achive the same goal.

    FWIW -- Both methods (NM or interfaces) will configure either DHCP IP addressing configuration parameters or static (via the interfaces file) IP addressing configuration parameters.
    Thank you, the way you explained makes things very clear!

    It also pointed out that there's one more important reality (which I was overlooking): the subnet.

    What I understand now (and I hope it's correct) is that if I have two Ethernet adapters I can have a different subnet (but only one, not two) for each adapter and both could be loaded at boot time and even accept different connections at the same time, but only one subnet / interface.

    For example, I can have two LANs (each with 4-5 workstations) and just one server machine with two ethernet adapters serving both LANs. Some services could be provided to localhost only, some to the first LAN via one ethernet adapter (one subnet), and some to the second LAN via the second ethernet adapter (second subnet). Some services could also be routed in various ways between these three interfaces through the server which also does the routing. But if all I got is an ethernet adapter and a wireless adapter, and if they are both on the same subnet, they can't be loaded both at the same time, because there'll be a conflict of addresses.

    By different subnets I understand addresses like:

    192.168.3.x (where x is a 1 to 255 number assigned to computers with the specified prefix 192.168.3.)
    192.168.100.x (where x is a 1 to 255 number assigned to computers with the specified prefix 192.168.100.)

    I think that both these subnets belong to the network 192.168.0.0 and they both should have 255.255.0.0 netmask. But I'm not pretty sure about these subnet numbers.

  9. #9
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    Quote Originally Posted by clearski View Post
    Thank you, the way you explained makes things very clear!

    It also pointed out that there's one more important reality (which I was overlooking): the subnet.

    What I understand now (and I hope it's correct) is that if I have two Ethernet adapters I can have a different subnet (but only one, not two) for each adapter and both could be loaded at boot time and even accept different connections at the same time, but only one subnet / interface.
    This is almost correct. You don't assign a subnet to a specific adapter. It might be helpful to think of each adapters configuration permitting the host to communicate with its peers in a specific subnet.
    For example, I can have two LANs (each with 4-5 workstations) and just one server machine with two ethernet adapters serving both LANs.
    It would be called a host participating in 2 LANS. And when you configure forwarding it becomes a router (passing traffic between the 2 networks. The term server at this level of discussion is not the physical hadware, but rather the services available. To put it another way; A server is a process that is always running, waiting to provide services to the requesting client (e.g HTTP or DNS or SSH or smbd (Samba) of NFS).
    Some services could be provided to localhost only, some to the first LAN via one ethernet adapter (one subnet), and some to the second LAN via the second ethernet adapter (second subnet). Some services could also be routed in various ways between these three interfaces through the server which also does the routing. But if all I got is an ethernet adapter and a wireless adapter, and if they are both on the same subnet, they can't be loaded both at the same time, because there'll be a conflict of addresses.
    Yes.

    By different subnets I understand addresses like:

    192.168.3.x (where x is a 1 to 255 number assigned to computers with the specified prefix 192.168.3.)
    192.168.100.x (where x is a 1 to 255 number assigned to computers with the specified prefix 192.168.100.)

    I think that both these subnets belong to the network 192.168.0.0 and they both should have 255.255.0.0 netmask. But I'm not pretty sure about these subnet numbers.
    But not necessarily. The terms subnet and network have changed slightly over the years. But for the most part a network is a block of IP addresses that you control (administer). One persons network is most likely another persons subnet. For example the network 3.0.0.0 /8 (3.0.0.0 with a subnet mask of 255.0.0.0) is owned by G.E.. The administrator could create a subnet of 3.0.0.0/24 (a subnet of 255.255.255.0) and assign a person to manage this sub network. All of this is much clearer if you look at the numbering of the network as the OS sees it; in a binary fashion.
    Code:
    00000011000000000000000000000000 <--3.0.0.0 /8 network (8 bits of mask)
    11111111000000000000000000000000  <--255.0.0.0 netmask that defines the network boundries
    
    00000011000000000000000000000000  <--3.0.0.0 /24 network (24 bits of mask)
    11111111111111111111111100000000  <--255.255.255.0 netmask that defines the network boundries
    Clearly the second network is a subset of the first. This means that any network that you control can be called a network and you may subnet it if you wish. The only limitation is that you need at least a network ID and a broadcast address and at least 2 host IP addresses to have a functioning network.

    I'm sure you have more questions now.
    -BAB1

  10. #10
    Join Date
    Apr 2013
    Beans
    130
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: to fill or not to fill interfaces

    You almost killed me with those 0s and 1s.

    By looking at your binary representation, I think that any address is seen (by the machine) as a group of 4 x 8 bits, which makes it a 32-bits address. As far as I remember, I think I read somewhere that IPV4 addresses are 32 bits and IPV6 are 128 bits.

    From your example, it is clear that the more we mask the network, the less "space" is has for a subnet (which is also logical).

    If my address is 192.168.5.1 and my netmask is 255.255.255.0, then my network could be written as 192.168.5.0 / 24, because I have the first 24 bits masking the address. It means that I could only use the last 8 bits (the free ones, which are not masked) of the network address for my router, computers from LAN etc. And if my address is 192.168.5.13 with a netmask 255.255.0.0, the network is 192.168.0.0 /16.

    If everything I wrote above is correct, I have three more questions.

    1. It is obvious that 00000000 = 0 and 11111111 = 255, but I can't figure out how did you know that 00000011 is the binary representation for number 3. Is there any formula or trick to find out what's the binary for 142, for example?

    2. I've only got two computers connected through a router. Let's say that my network is 192.168.1.0 and my netmask 255.255.255.0 (or 192.168.1.0 /24, to speak a more advanced language now ). With the current netmask I have 254 remaining addresses for my computers or any other network devices. If I change my netmask to 255.255.255.251, does it mean that the only addresses available on this network would be 192.168.1.252 (let's say for the router) and 192.168.1.253 (computer 1) and 192.168.1.254 (computer 2)?

    3. Can I also do my netmasking like this: 255.255.0.255 ? Is this still a 0.0.0.0 /24 masking?

    This is very interesting and very useful. I cannot thank you enough for your time and help.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •