View Single Post
  #9   (View Single Post)  
Old 18th June 2015
Peter_APIIT Peter_APIIT is offline
Shell Scout
 
Join Date: Jun 2008
Posts: 121
Default

Quote:
Originally Posted by jggimi View Post
Do not use mygate(5). You added a default route in your hostname.pppoe0 file. That used the reserved address 0.0.0.1, which the pppoe(4) man page defined as a "wildcard" for the remote address. During PPPoE negotiation, this address was revised with the ISP provided remote address, and as PPP is Point-to-Point, that is the correct default route.

What is missing from the route table is your local network. Perhaps that is still undefined, or incorrectly addressed.

---

To try to help you, I've written up an example below. Please excuse the small amount of education which follows, in the event you already understand.

---

In TCP/IP, local networks can have variable sizes. The size of a local network is defined by a netmask. A netmask is a string of bits that start with ones, and end with zeros. The bits that are zeros define the size of the local network. Because it is inconvenient for humans to read long strings of ones and zeros, we either use decimal values, such as 255.255.255.0, or, because netmasks always begin with ones and end with zeros, we can use CIDR notation, where we just count the number of leading ones, such as /24.

Both 255.255.255.0 and /24 mean exactly the same thing: a netmask value of

11111111111111111111111100000000.

I chose a /24 network for my example, because it is a very common size for local networks. This is because humans use a.b.c.d address notation for IPv4, and a /24 network means the last octet, .d, is used for addresses on the local network. Note that there are eight zeros in that octet, defining values between 0 and 256. In this local network, there are a maximum of 256 local addresses, 254 of which can be used for devices. (All zeros, x.x.x.0, is reserved for routing, and all ones, x.x.x.255, is reserved for broadcast messages.)

With an IP address and netmask, any NIC driver can determine if an outgoing IP packet is destined for the local network, or destined elsewhere. If the packet needs to leave the local network, it must be routed.

Routing tables are usually very simple. They answer one question for the device. "What is the address of a router on my local network where I can send this packet so it can forward it somewhere else?"

That's it.

---

Let's look at a very simple, typical home network. It has a private network, 192.168.1.0/24. There are 256 local addresses, 254 of which can be used for devices. There is a single router, which we have defined at the address 192.168.1.1. There are two workstations, which we have defined at the addresses 192.168.1.2 and 192.168.1.3. Because this is an RFC 1918 subnet, the local addresses are not routable on the internet and this network uses NAT. The "real" Internet address is shared by the workstations and the router, and is assigned by the ISP. In our example, that "real" internet address is 203.0.113.22.

{Internet} - 203.0.113.22 [router] 192.168.1.1 [workstations 192.168.1.2 - 192.168.1.3]

Each of the workstations has one NIC. The router has two NICs: one NIC on the local network, the other NIC on the Internet.

The three devices on the local network can communicate with each other without routing. Each NIC driver knows its IP address, and its netmask, and any packets destined for the local network are sent directly.

If you are using one of the two workstations, and you wish to reach an address on the Internet, the NIC will know that your outgoing packet must be routed. The workstation must know the address of the router. It must know the answer to "When I need to send a packet to an address not on this local network, which device on this network do I send it to?

That device would be the router, at local address 192.168.1.1 on the local network, and which also has Internet address 203.0.113.22 on its NIC connected to the Internet.

When there is only one router on a local network, the workstation only need one key address in its routing table. The default route. This is the address of a router on the local network that routes all traffic destined to other networks, regardless of address.

Your workstation gets this default route one of two ways. Dynamically, perhaps via a DHCP server, or statically, by manual configuration. If that workstation is OpenBSD, routing assignments are made via DHCP or other dynamic tools, or via mygate(5), used when assigning a static default route for a system where IP addresses are assigned statically.

Now, lets turn to the router. In our example, the router has two networks to deal with. It's internal, 192.168.1/24 network, and its external network. The ISP provided the 203.0.113.22 IP address, a /28 netmask (255.255.255.240), and its own default route, 203.0.113.17. The router must assign the IP address and netmask to that external facing NIC, and the default route to its routing table. The router's tables will have two two key routes. An explicit route for addresses on the local subnet 192.168.1/24, via its internal facing NIC, and a default route to the Internet, on its externally facing NIC, for all addresses other than those in 192.168.1/24.

If PPPoE was used in our example router, the negotiation should automatically create the default route to 203.0.113.17.
First of all,

Thanks for your brief explanation.
The written information is very informative yet useful.

Netmask is used to determines the size of network.
Zero represents size of networks in binary form.
x.x.x.0 is reserved for routing
x.x.x.255 is reserved for broadcast

Each entry in routing table represents one hops.
As you mentioned, default route represents routes all traffic to other networks (Internet).

There are two entry in the routing table.
1. default route to INTERNET
2. Route for 192.168.1/24 local subnet

The OpenBSD box will NAT its private address from internal IP to external IP address and forward to external NIC for further routing.

Answers:
I'm think need to change the internal NIC IP address to 192.168.1.1 via /etc/hostname.vr0 and put this address to workstation as gateway address.
Reply With Quote