I have two Linux hosts HOST1 and HOST2 connected by cross cable. How I can break the network between then without breaking the physical wire (I don't have access).

If i do:

HOST1# ifconfig eth0 down

Then NIC card will down. I just want to down link. Is any other way we can make network link down?

  • What is the end goal here. Once the machines are separated do you still need access to them? – tkrabec Aug 17 '11 at 23:55
  • You say that they are connected by a cross cable, so I assume that it's a direct connection between the two hosts. What is the problem with bringing the interface(s) down? – pferate Aug 18 '11 at 0:31

If the cards are supported, you could probably use mii-tool -F or ethtool to force both ends into incompatible speeds.

Be sure to get the correct setting first so you can set them back to normal.

| improve this answer | |
  • thanks for inputs, i am not sure how to set eth0 in incompatible speeds, Please provide the commands . – Vijay Aug 16 '11 at 13:54
  • wouldn't this be equivalent to shutting down the interface? – Silverfire Aug 18 '11 at 2:11

You can setup a reject route in the routing table.

# route add -net X.X.X.X netmask reject

If you want it persistent, you can add it to rc.local or something similar.

| improve this answer | |
  • i was going to say the exact same thing :) – Silverfire Aug 18 '11 at 2:08

Depending on the exact outcome you want, you could implement subinterfaces and VLANs. This page has some configuration info: http://nixcraft.com/networking-firewalls-security/10447-linux-vlan-configuration.html

| improve this answer | |
  • , Please provide the example in detail – Vijay Aug 16 '11 at 15:37

(install the iproute2 tool) and use this:

ip link set eth0 down

This will disable the link, bit keep the config.

| improve this answer | |
  • "ip link set eth0 down" is equal to "ifconfig eth0 down" – Vijay Aug 16 '11 at 13:45
  • You asked for "any other way we can make network link down?", which i answered... – Silent-Bob Aug 16 '11 at 14:02

What's the current configuration? What are you trying to accomplish?

Short of turning down NICs or pulling the cable, you could ensure those interfaces are in different IP networks (or remove IPs) so they can no longer communicate.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.