0

Let us start from closing my eth0.192.168.1.4 is binded with eth0.

root@hwy:/home/debian8# ifconfig eth0 down   

root@hwy:/home/debian8# route -nv    

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

root@hwy:/home/debian8# ifconfig

eth0 Link encap:Ethernet HWaddr e0:3f:49:57:4b:d1
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::e23f:49ff:fe57:4bd1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:918 errors:0 dropped:0 overruns:0 frame:0
TX packets:184 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:195407 (190.8 KiB) TX bytes:29304 (28.6 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:496 errors:0 dropped:0 overruns:0 frame:0
TX packets:496 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:728348 (711.2 KiB) TX bytes:728348 (711.2 KiB)

wlan0 Link encap:Ethernet HWaddr 00:21:5d:26:c1:10
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::221:5dff:fe26:c110/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6556 errors:0 dropped:0 overruns:0 frame:0
TX packets:5709 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3528018 (3.3 MiB) TX bytes:999397 (975.9 KiB)

Maybe the eth0 is closed .

traceroute -i eth0  stackoverflow.com
traceroute to stackoverflow.com (104.16.36.249), 30 hops max, 60 byte packets

 1  * * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

Something confued me that 192.168.1.4 can still be used in my local network. There is a wordpress build on my local network.

root@hwy:/home/debian8# cat /etc/hosts
192.168.1.4 mywp.com

And all my url in the wordpress is in the form of http://mywp.com/wp/?p=2026. If eth0 is closed by the command ifconfig eth0 down,the ip 192.168.1.4 can't be used,but why my wordpress can be visited on my local network?
There is only one result that the eth0 still work ,why can not be closed by the command ifconfig eth0 down ?

Think to Warren Young .

ifdown eth0
ifdown: interface eth0 not configured
root@hwy:/home/debian8# ping 192.168.1.4
PING 192.168.1.4 (192.168.1.4) 56(84) bytes of data.
From 192.168.1.101 icmp_seq=1 Destination Host Unreachable
From 192.168.1.101 icmp_seq=2 Destination Host Unreachable
From 192.168.1.101 icmp_seq=3 Destination Host Unreachable
From 192.168.1.101 icmp_seq=4 Destination Host Unreachable
From 192.168.1.101 icmp_seq=5 Destination Host Unreachable
From 192.168.1.101 icmp_seq=6 Destination Host Unreachable
64 bytes from 192.168.1.4: icmp_seq=7 ttl=64 time=1001 ms
64 bytes from 192.168.1.4: icmp_seq=8 ttl=64 time=0.006 ms
64 bytes from 192.168.1.4: icmp_seq=9 ttl=64 time=0.026 ms
64 bytes from 192.168.1.4: icmp_seq=10 ttl=64 time=0.032 ms

Maybe this is a important clue:
My wordpress was build on local pc,there are two ips and two net cards on my local pc,192.168.1.4 was binded with eth0 ,192.168.1.101 was binded with wlan0.eth0 was banned by command ifdown eth0.

  • Are you sure the other computers on the local network are using the 192.168.1.4? Is the 192.168.1.4 mywp.com record in their /etc/hosts? – Marti Markov Nov 23 '15 at 13:01
  • You cannot have the same netblock in eth0 and wlan0 – Rui F Ribeiro Nov 23 '15 at 13:49
  • only two computers ,yes there is 192.168.1.4 mywp.com record in it's /etc/hosts,but the other computer ip is 192.168.1.100. – it_is_a_literature Nov 23 '15 at 13:51
1

ifconfig eth0 down

Unless you're doing something uncommon (e.g. applying IP aliases) you should not be using ifconfig (or its successor, ip(8)) directly. You should say ifdown eth0 here. That takes care of many things that ifconfig does not.

traceroute -i eth0 stackoverflow.com

Your route table says the default route is via wlan0, not eth0, so you're not testing what you think you are.

192.168.1.4 can still be used in my local network

Of course. If you look back at the ifconfig output, you will see UP in the eth0 section.

192.168.1.4 mywp.com

You should not be using .com or other official TLDs for private networks. For purely local hosts defined in /etc/hosts, you don't need to fully-qualify them at all. This is perfectly legal:

192.168.1.4 mywp

With that /etc/hosts entry, you can visit http://mywp in your browser. Be careful: this movement in modern browsers to unify the search and location boxes means that typing mywp alone in the box will likely be treated as a web search term, not a host name. Most browsers will skip that if you include some sort of punctuation, so that mywp/ will tell the browser you mean for it to treat mywp as a host name, not a web search term.

If you feel the need for fully-qualified domain names, adjust your networking configuration to assign a local domain name to the LAN, such as literature.private. The .private TLD is a traditional option for local-only domains. (Another common alternative is .local.) The literature part I just took from your user name.

Having done that, the same /etc/hosts entry will still be looked up correctly if you go to http://mywp.literature.private in your web browser.

  • ifdown eth0 ifdown: interface eth0 not configured – it_is_a_literature Nov 23 '15 at 13:53
  • @it_is_a_literature: Reboot your box and try again. I suspect your previous manual ifconfig commands have confused the ifdown program. – Warren Young Nov 23 '15 at 13:54
  • i am still puzzled!!why 192.168.1.4 can be accessed? – it_is_a_literature Nov 24 '15 at 0:56
  • ifdown eth0 ifdown: interface eth0 not configured – it_is_a_literature Nov 24 '15 at 0:56
  • @it_is_a_literature: Are you certain your system actually has an eth0? I know it shows up in the list above, but that could just be because of prior misconfiguration. For example, maybe your system is using Consistent Network Device Naming, so your Ethernet interface is called something other than eth0. Or, maybe your system is wifi-only, so there is only wlan0. – Warren Young Nov 24 '15 at 1:00

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.