Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to disconnect an NIC that configured manually?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

How to disconnect an NIC that configured manually?

#1 Post by hack3rcon »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#2 Post by Head_on_a_Stick »

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
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#3 Post by p.H »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#4 Post by Head_on_a_Stick »

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.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#5 Post by p.H »

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.

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: How to disconnect an NIC that configured manually?

#6 Post by hack3rcon »

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

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#7 Post by Head_on_a_Stick »

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!
deadbang

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: How to disconnect an NIC that configured manually?

#8 Post by hack3rcon »

I want to connect and disconnect the NIC.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to disconnect an NIC that configured manually?

#9 Post by p.H »

You are just paraphrasing, not explaining.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: How to disconnect an NIC that configured manually?

#10 Post by bw123 »

NIC hasn't been configured manually, interfaces file is empty.
resigned by AI ChatGPT

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: How to disconnect an NIC that configured manually?

#11 Post by reinob »

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).

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: How to disconnect an NIC that configured manually?

#12 Post by hack3rcon »

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?

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: How to disconnect an NIC that configured manually?

#13 Post by reinob »

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.

hack3rcon
Posts: 746
Joined: 2015-02-16 09:54
Has thanked: 48 times

Re: How to disconnect an NIC that configured manually?

#14 Post by hack3rcon »

Thank you.

Post Reply