How to disconnect an NIC that configured manually?

Kernels & Hardware, configuring network, installing services

How to disconnect an NIC that configured manually?

Postby hack3rcon » 2019-01-27 07:47

Hello.
When an NIC configured manually then how can I plug and unplug it? "ifdown" command not worked:
Code: Select all
$ sudo ifdown eht1
ifdown: interface eht1 not configured


Thank you.
hack3rcon
 
Posts: 105
Joined: 2015-02-16 09:54

Re: How to disconnect an NIC that configured manually?

Postby Head_on_a_Stick » 2019-01-27 08:31

hack3rcon wrote:an NIC configured manually

How exactly did you do this?

hack3rcon wrote:
Code: Select all
ifdown: interface eht1 not configured

^ This indicates that eth1 is not listed in /etc/network/interfaces
"The trouble with the world is that the stupid are cocksure and the intelligent full of doubt." — Bertrand Russell
User avatar
Head_on_a_Stick
 
Posts: 8838
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to disconnect an NIC that configured manually?

Postby p.H » 2019-01-27 09:26

hack3rcon wrote:When an NIC configured manually

What do you mean ?
hack3rcon wrote:plug and unplug it

What do you mean ?
Head_on_a_Stick wrote:This indicates that eth1 is not listed in /etc/network/interfaces

No, it means that eth1 was not configured with ifup.
p.H
 
Posts: 754
Joined: 2017-09-17 07:12

Re: How to disconnect an NIC that configured manually?

Postby Head_on_a_Stick » 2019-01-27 09:36

p.H wrote:
Head_on_a_Stick wrote:This indicates that eth1 is not listed in /etc/network/interfaces

No, it means that eth1 was not configured with ifup.

And ifup is configured via /etc/network/interfaces, no?

@OP: what is the output of
Code: Select all
/sbin/ifquery eth1
cat /etc/network/interfaces
ip link

EDIT: no, wait, you are right about ifup, thanks for the correction.
"The trouble with the world is that the stupid are cocksure and the intelligent full of doubt." — Bertrand Russell
User avatar
Head_on_a_Stick
 
Posts: 8838
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to disconnect an NIC that configured manually?

Postby p.H » 2019-01-27 09:43

Head_on_a_Stick wrote:And ifup is configured via /etc/network/interfaces, no?

Yes, and other files sourced by it.
What I mean is that you also get the same message if the interface is present in any of these files but has not been configured.by ifup yet.
p.H
 
Posts: 754
Joined: 2017-09-17 07:12

Re: How to disconnect an NIC that configured manually?

Postby hack3rcon » 2019-01-27 11:35

Head_on_a_Stick wrote:
p.H wrote:
Head_on_a_Stick wrote:This indicates that eth1 is not listed in /etc/network/interfaces

No, it means that eth1 was not configured with ifup.

And ifup is configured via /etc/network/interfaces, no?

@OP: what is the output of
Code: Select all
/sbin/ifquery eth1
cat /etc/network/interfaces
ip link

EDIT: no, wait, you are right about ifup, thanks for the correction.


Output are:
Code: Select all
$ sudo /sbin/ifquery eth1
Unknown interface eth1

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 94:de:80:b8:1a:54 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 00:11:3b:15:4a:32 brd ff:ff:ff:ff:ff:ff
hack3rcon
 
Posts: 105
Joined: 2015-02-16 09:54

Re: How to disconnect an NIC that configured manually?

Postby Head_on_a_Stick » 2019-01-27 11:54

hack3rcon wrote:
Code: Select all
$ sudo /sbin/ifquery eth1

Pro tip: don't use `sudo` unless you really have to.

And please answer the other questions raised by @p.H, thanks!
"The trouble with the world is that the stupid are cocksure and the intelligent full of doubt." — Bertrand Russell
User avatar
Head_on_a_Stick
 
Posts: 8838
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to disconnect an NIC that configured manually?

Postby hack3rcon » 2019-01-27 12:00

I want to connect and disconnect the NIC.
hack3rcon
 
Posts: 105
Joined: 2015-02-16 09:54

Re: How to disconnect an NIC that configured manually?

Postby p.H » 2019-01-27 12:36

You are just paraphrasing, not explaining.
p.H
 
Posts: 754
Joined: 2017-09-17 07:12

Re: How to disconnect an NIC that configured manually?

Postby bw123 » 2019-01-27 17:40

NIC hasn't been configured manually, interfaces file is empty.
User avatar
bw123
 
Posts: 3751
Joined: 2011-05-09 06:02
Location: TN_USA

Re: How to disconnect an NIC that configured manually?

Postby reinob » 2019-01-28 07:20

hack3rcon wrote:I want to connect and disconnect the NIC.


with ifconfig you can:

# ifconfig eth1 up <your-ip-address>

and then

# ifconfig eth1 down

I'll leave it as an exercise to do the above using the more modern "ip" command (ifconfig is deprecated).
reinob
 
Posts: 597
Joined: 2014-06-30 11:42

Re: How to disconnect an NIC that configured manually?

Postby hack3rcon » 2019-01-28 07:28

reinob wrote:
hack3rcon wrote:I want to connect and disconnect the NIC.


with ifconfig you can:

# ifconfig eth1 up <your-ip-address>

and then

# ifconfig eth1 down

I'll leave it as an exercise to do the above using the more modern "ip" command (ifconfig is deprecated).


Thank you, but why "ifdown" command can't do it?
hack3rcon
 
Posts: 105
Joined: 2015-02-16 09:54

Re: How to disconnect an NIC that configured manually?

Postby reinob » 2019-01-28 07:55

hack3rcon wrote:
reinob wrote:
hack3rcon wrote:I want to connect and disconnect the NIC.


with ifconfig you can:

# ifconfig eth1 up <your-ip-address>

and then

# ifconfig eth1 down

I'll leave it as an exercise to do the above using the more modern "ip" command (ifconfig is deprecated).


Thank you, but why "ifdown" command can't do it?


ifup and ifdown work with definitions from /etc/network/interfaces, so they require that you configure your networking using that system (which has been told to you already in this very thread by a number of knowledgeable people), but you said you want to do it manually, so I've told you how to do it manually.

maybe you want to first think about how you want to configure your network (manually, ifupdown, network manager, connman, systemd-networkd, etc.) and then you ask if you have a question.
reinob
 
Posts: 597
Joined: 2014-06-30 11:42

Re: How to disconnect an NIC that configured manually?

Postby hack3rcon » 2019-01-28 07:59

Thank you.
hack3rcon
 
Posts: 105
Joined: 2015-02-16 09:54


Return to System configuration

Who is online

Users browsing this forum: GRzenabI and 7 guests

fashionable