Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ip of my computer
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Fri Jan 24, 2003 3:59 pm    Post subject: ip of my computer Reply with quote

My computer is used both as router+gateway and both as server. I have dsl with dynamic ip. The computer has 2 NICs: eth0 is set to receive the dynamic ip through dhcpcd and eth1 is set as gateway. My question is:

Should I use the eth1 gateway address as the computer ip or should I create another ip (in /etc/hosts)? It seemed that both way will work and I have searched the web for this point but haven't found anything clear. :(
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
Lemma
Guru
Guru


Joined: 19 Apr 2002
Posts: 416
Location: Uppsala, Sweden

PostPosted: Fri Jan 24, 2003 4:12 pm    Post subject: Reply with quote

I'm not sure if I have gotten this right but as I can see the answer is that the computer will have not one but two addresses; one that is your "official", that is the one that you use when "talking" with computers outside your net, and one that you will use when acting as a part of your own network. Eth0 -> 130.238.*.* (if you are a part of the Uppsala University ;-)) and eth1 -> 192.168.0.1 or similar as the local gateway.
_________________
Always make it as simple as possible, but no simpler
/Einstein
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Fri Jan 24, 2003 4:57 pm    Post subject: Reply with quote

You should set up your clients with gateway the eth1-ip (the static one). If you fill in the dynamic one, the internet sharing wont work anymore if the dynamic IP is changed (actually it shouldn't work in the first place since the dynamic IP isn't in your subnet).
Back to top
View user's profile Send private message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Fri Jan 24, 2003 8:21 pm    Post subject: re: computer ip Reply with quote

1. I completely agree that we can't use the dynamci ip as the computer ip address.

2. In case if I have ONLY one network to connect to then in this case I can use the ip of the gateway as the computer ip address. I also agree with this since it will work.

3. However, when I have more than one network to connect to. Let's say 2 networks then the computer will have eth1 and eth2. In this case, which ip address you will choose for the computer? :wink: Have you follow my argument? I believe that in thsi case, I should create another ip address for the computer rather than select the ip of either eth1 or eth2?
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
Matje
l33t
l33t


Joined: 29 Oct 2002
Posts: 619
Location: Hasselt, Belgium

PostPosted: Fri Jan 24, 2003 11:04 pm    Post subject: Reply with quote

I'm presuming you use a DHCP server to distribute ip's to your clients, if not, you can just setup the computers on eth2 to use the ip of eth2 as gateway. In your dhcp.conf each of the subnets your pc is on needs to be defined, so you just define 192.168.0.x (eth1) and give it the option default-gateway 192.168.0.1, and then you define 192.168.1.x (eth2) and give it the option default gateway 192.168.1.1. I'm not sure about the option-name, as I'm not around a gw right now and am too lazy to ssh to one :-)

And about which IP to choose for your pc, I can't really follow that argument... Each and every one of your ip's points to your machine. In fact, in /etc/hosts you don't need to add an external IP, 127.0.0.1 does just fine:
Code:
127.0.0.1       localhost
127.0.0.1       lambik.lanzone.lnet

_________________
Life is like a box of chocolates... Before you know it, it's empty...
Back to top
View user's profile Send private message
Matje
l33t
l33t


Joined: 29 Oct 2002
Posts: 619
Location: Hasselt, Belgium

PostPosted: Fri Jan 24, 2003 11:08 pm    Post subject: Reply with quote

And yes, you can also add all of your IP's to that like so:
Code:

127.0.0.1    localhost
127.0.0.1    lambik.lanzone.lnet
192.168.0.1 localhost
x.x.x.x       localhost

But this won't make any difference, since the first in the file is used if you ping localhost :-)
_________________
Life is like a box of chocolates... Before you know it, it's empty...
Back to top
View user's profile Send private message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Sat Jan 25, 2003 1:04 am    Post subject: re: computer's ip Reply with quote

>And about which IP to choose for your pc, I can't really follow that argument.

If you read my original post, you know that it is used as a router AND a server. A server needs an ip address. Of course, you can use either eth1's ip or eth2's ip as its ip address.

Anyway, thanks for all the interests.

:wink:
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
Naan Yaar
Bodhisattva
Bodhisattva


Joined: 27 Jun 2002
Posts: 1549

PostPosted: Sat Jan 25, 2003 2:32 am    Post subject: Re: re: computer's ip Reply with quote

An IP address is not associated with the computer but the interface. So, for a box that is a gateway, there is no "computer's ip". It has two (or more) interfaces with one address on each interface. You can also do IP aliasing to bind multiple addresses to the same interface. In fact, even without being a gateway, you have two IP addresses, the one associated with the network card and the loopback (127.0.0.1).

You may want to read the Network Administrators Guide, esp. this section.
bluesky wrote:

If you read my original post, you know that it is used as a router AND a server. A server needs an ip address. Of course, you can use either eth1's ip or eth2's ip as its ip address.

Anyway, thanks for all the interests.

:wink:
Back to top
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sat Jan 25, 2003 9:05 am    Post subject: Reply with quote

I have a computer here that provides internetsharing et al, with 5 network devices (eth0-eth3, ppp0). ppp0 is the interface connected to the internet...
Code:

ppp0     213.224.35.31
eth0     192.168.10.1
eth1     192.168.11.1
eth2     192.168.12.1
eth3     192.168.13.1


Each ethX device is connected to a network (subnetmask 255.255.255.0) and is a gateway for that respective network.

So each interface has the IP that plays the gateway for that network.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum