LinuxQuestions.org
Visit Jeremy's Blog.
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-21-2015, 07:23 AM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Rep: Reputation: Disabled
Which ip is on work now?


Here is my /etc/network/interfaces file.
Code:
auto wlan0
iface wlan0 inet manual
wpa-driver nl80211
wpa-roam /etc/wpa_supplicant.conf
iface default inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
if-up ifconfig eth0 down
The info display on the screen when to input 'ifconfig'.
Code:
eth0      Link encap:Ethernet  HWaddr e0:3f:49:57:4b:d1  
          inet addr:192.168.1.3  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:6068 errors:0 dropped:0 overruns:0 frame:0
          TX packets:113 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3780468 (3.6 MiB)  TX bytes:11800 (11.5 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:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:700 (700.0 B)  TX bytes:700 (700.0 B)

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:1291 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5146 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81917 (79.9 KiB)  TX bytes:992000 (968.7 KiB)
Now i am cofused that which ip is mine ?192.168.1.3 or 192.168.1.101
Which one is at work ?192.168.1.3 or 192.168.1.101
 
Old 11-21-2015, 07:49 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,837

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
most probably both are available. You need to check your route config to see which one is the preferred (execute the command route)
 
1 members found this post helpful.
Old 11-21-2015, 07:58 AM   #3
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Original Poster
Rep: Reputation: Disabled
route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan0
 
Old 11-21-2015, 02:05 PM   #4
onlyonemac
Member
 
Registered: Dec 2014
Distribution: Ubuntu MATE
Posts: 65

Rep: Reputation: Disabled
You have two IP addresses. One refers to your ethernet card and the other refers to your wireless card. Which card is used by default depends on your configuration (it's usually the ethernet card if it's available).
 
1 members found this post helpful.
Old 11-21-2015, 08:04 PM   #5
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Original Poster
Rep: Reputation: Disabled
Do two ip addresses can be used at the same time?
How can i make wlan0 be defaultly active ?
Which ip is being used when to connect to http://www.linuxquestions.org

Last edited by luofeiyu; 11-21-2015 at 08:21 PM.
 
Old 11-22-2015, 01:04 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by luofeiyu View Post
Do two ip addresses can be used at the same time?
How can i make wlan0 be defaultly active ?
Which ip is being used when to connect to http://www.linuxquestions.org?
First question: Yes.
Second question: Depends on your distro. Yours seems to be Debian-based, so look for advice on help.ubuntu.com, or the Mint wiki, or the Debian wiki.
Third question: This depends on your routing table. Your routing table indicates that you will use wlan0:
Code:
Destination Gateway     Genmask        Flags Metric Ref Use Iface
default     192.168.1.1 0.0.0.0        UG    0      0   0   wlan0
192.168.1.0 *           255.255.255.0  U     0      0   0   eth0
192.168.1.0 *           255.255.255.0  U     0      0   0   wlan0
Since the IP address of linuxquestions.org is not in the 192.168.1.0/24 range, the default route will be used.
 
Old 11-22-2015, 01:07 AM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by berndbausch View Post
First question: Yes.
Second question: Depends on your distro. Yours seems to be Debian-based, so look for advice on help.ubuntu.com, or the Mint wiki, or the Debian wiki.
Third question: This depends on your routing table. Your routing table indicates that you will use wlan0:
Code:
Destination Gateway     Genmask        Flags Metric Ref Use Iface
default     192.168.1.1 0.0.0.0        UG    0      0   0   wlan0
192.168.1.0 *           255.255.255.0  U     0      0   0   eth0
192.168.1.0 *           255.255.255.0  U     0      0   0   wlan0
Since the IP address of linuxquestions.org is not in the 192.168.1.0/24 range, the default route will be used.
If you want to learn about networking, there are many tutorials out there. One that I happen to know about is http://www.linuxhomenetworking.com, though it doesn't seem to be well maintained.
 
  


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
Google Hangout doesn't work, and Mplayer doesm't work without -ao alsa flagGoogle H ranban282 Linux - Software 0 02-20-2012 04:23 AM
[SOLVED] Sound comes and goes in Flash, no media players work, system sounds generally DO work damgar Arch 2 07-03-2010 12:46 PM
With PCI bridge TI PCI2050, VT6212's EHCI can't work(time out), but its UHCI can work thisway.diy Linux - Kernel 0 10-23-2009 09:32 PM
can't make ethernet on laptop work, wireless and usb work fine ubuntu 8.10 rz1988 Linux - Newbie 10 01-13-2009 02:21 PM
FALCONS EYE (nethack) FAILS ON STARTUP, use to work, wont work even after reinstall roorings Linux - Software 0 10-08-2003 10:39 PM

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

All times are GMT -5. The time now is 08:12 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
Open Source Consulting | Domain Registration