LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-24-2017, 10:19 AM   #1
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,644

Rep: Reputation: 112Reputation: 112
Question What is the name of an interface in Ubuntu?


Perhaps this belongs in the Ubuntu forum but I would hope the answer can be found in generic networking. Here is the issue...

On a CentOS 7 machine I can identify an Ethernet interface, stop and restart it thus
Code:
[root@taylor20 ken]# ip link
...
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 48:4d:7e:e7:bd:1b brd ff:ff:ff:ff:ff:ff
...
[root@taylor20 ken]# ifdown enp0s31f6
Device 'enp0s31f6' successfully disconnected.
[root@taylor20 ken]# ifup enp0s31f6
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/109)
If I try the same approach on Ubuntu Mate 16.04 I observe
Code:
root@ubuntu:/home/ken/Desktop# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:0c:29:d3:05:c4 brd ff:ff:ff:ff:ff:ff
root@ubuntu:/home/ken/Desktop# ifdown ens32
Unknown interface ens32
The NetworkManager GUI shows the following Connection Information

Wired connection 1 (default)
General
Interface: Ethernet (ens32)

I tried ifdown "Ethernet (ens32)" but that did not work. Same for "Wired connection 2" How do I find the name by which ifdown identifies the interface?

TIA,

Ken
 
Old 11-24-2017, 11:14 AM   #2
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Distribution: SLES 12
Posts: 1,876

Rep: Reputation: 134Reputation: 134
Then type "ifconfig" in terminal and see the result.
 
Old 11-24-2017, 11:30 AM   #3
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,644

Original Poster
Rep: Reputation: 112Reputation: 112
Thanks Keruskerfuerst,

However, ifconfig shows me the same unrecognized name
Code:
root@ubuntu:/home/ken/Desktop# ifconfig
ens32     Link encap:Ethernet  HWaddr 00:0c:29:d3:05:c4  
          inet addr:10.42.0.180  Bcast:10.42.0.255  Mask:255.255.255.0
          inet6 addr: fe80::e85c:4eca:2ffd:d2b8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77 errors:0 dropped:0 overruns:0 frame:0
          TX packets:138 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:8282 (8.2 KB)  TX bytes:15058 (15.0 KB)
Ken
 
Old 11-24-2017, 01:09 PM   #4
Keruskerfuerst
Senior Member
 
Registered: Oct 2005
Distribution: SLES 12
Posts: 1,876

Rep: Reputation: 134Reputation: 134
I have done a search in ubuntu wiki and you should use "ip"

ss (socket status, netstat replacement)

lnstat (link state, also ctstat)

nstat (network statistics tool)

routef (flush routes)

routel (list routes)

rtstat (route state monitoring)
 
Old 11-24-2017, 04:33 PM   #5
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,644

Original Poster
Rep: Reputation: 112Reputation: 112
Sorry Keruskerfuerst but I do not understand what you are recommending. I used ip in my original example. ip link to be specific. It returned ens32 which ifdown/ifup will not recognize. routel tells me ens32 as well.

Ken
 
Old 11-24-2017, 04:35 PM   #6
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, Fedora & Arch mostly.
Posts: 2,538

Rep: Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693
Is networkmanager controlling the interface? If so, ifup/ifdown won't be able to do anything on it. However the interface name is correct given in ip link/ifconfig.
 
1 members found this post helpful.
Old 11-24-2017, 04:52 PM   #7
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,644

Original Poster
Rep: Reputation: 112Reputation: 112
Thanks Timothy Miller,

NetworkManager is controlling the interface on both the Ubuntu and CentOS machines. ifup/ifdown works just fine on CentOS. I am looking for a way to control the interface from a script in Ubuntu. I have it working on CentOS.

Ken
 
Old 11-24-2017, 05:05 PM   #8
Timothy Miller
Moderator
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian, Fedora & Arch mostly.
Posts: 2,538

Rep: Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693Reputation: 693
In anything Debian based, you'll need to control the interface from the /etc/network/interfaces for ifup/ifdown to control it, which will prevent networkmanager from controlling it. If you want to script something while keeping networkmanager controlling it, you'll have to use nmcli to bring interfaces up and down.
 
1 members found this post helpful.
Old 11-24-2017, 06:50 PM   #9
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 1,644

Original Poster
Rep: Reputation: 112Reputation: 112
Thanks again Timothy Miller,

I guess nmcli is the correct tool. However, about 2/3 of the examples I have found of of how to use nmcli do NOT work in Ubuntu (?). Anyhow I do find
Code:
root@ubuntu:/home/moe/Desktop# nmcli device
DEVICE  TYPE      STATE      CONNECTION         
ens33   ethernet  connected  Wired connection 1 
lo      loopback  unmanaged  --
I then tried referring to the connection as "Wired connection 1" and it does in fact work
Code:
root@ubuntu:/home/moe/Desktop# nmcli con down "Wired connection 1"
Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

root@ubuntu:/home/moe/Desktop# nmcli con up "Wired connection 1"
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)
nmcli networking off/on will cycle the the connection but it also cycles ALL connections. I only need to cycle one.

Bottom line, I have a path forward. Again my thanks!

Ken
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Ubuntu Devs Propose Stateless Persistent Network Interface Names for Ubuntu and Debian LXer Syndicated Linux News 0 05-11-2015 11:06 PM
Trying to interface Glade 3.6.7 and 'C' in Ubuntu 10.10 wd5jhi Programming 1 04-19-2011 10:13 AM
LXer: Ubuntu Software Center Receives Major User Interface Update, More [Ubuntu 10.10 LXer Syndicated Linux News 0 06-29-2010 07:50 PM
LXer: Ubuntu 10.10 Will Get Unity, Ubuntu Light Interface LXer Syndicated Linux News 0 05-10-2010 04:10 PM
ERROR: The interface does not exist (UBUNTU) interface eth0 not configured anshulbhatt Linux - Networking 2 11-20-2008 01:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration