kara334
asked on
Trouble Creating a Routing Table
Hi,
I am trying to complete an assignment for a class about subnets and routing tables. I am using the terninal shell on my Mac.
I assigned the IP address 192.168.3.1 to en0. (My teacher's instructions were to assign the address to eth0, but apparently my Mac doesn't use that interface).
Next I was told to test various network addresses and netmasks using the route command. I tried for several that should be legal, but got the error msg "illegal option -a".
Here are a couple of combinations I tried that I think should be legal:
network address: 209.220.186.96 subnet 255.255.255.224
network address: 209.220.186.240 subnet 255.255.255.240
I used the follow command to try to add them to the routing table"
route -add -net 209.220.186.96 netmask 255.255.255.224
etc.
Is there anyone that can help me and tell me what I'm doing wrong?
Thanks.
Kara
I am trying to complete an assignment for a class about subnets and routing tables. I am using the terninal shell on my Mac.
I assigned the IP address 192.168.3.1 to en0. (My teacher's instructions were to assign the address to eth0, but apparently my Mac doesn't use that interface).
Next I was told to test various network addresses and netmasks using the route command. I tried for several that should be legal, but got the error msg "illegal option -a".
Here are a couple of combinations I tried that I think should be legal:
network address: 209.220.186.96 subnet 255.255.255.224
network address: 209.220.186.240 subnet 255.255.255.240
I used the follow command to try to add them to the routing table"
route -add -net 209.220.186.96 netmask 255.255.255.224
etc.
Is there anyone that can help me and tell me what I'm doing wrong?
Thanks.
Kara
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, that sounds like it will work. But I don't know my gateway or default gateway. When I do ifconfig, I don't see it. Can you help me figure out my gateway? Thank you.
netstat -nr
or
route -n
should show it to you.
or
route -n
should show it to you.
ASKER
Thank you again. I think I found the default gateway - 192.168.1.1. But obviously I'm doing something else wrong. (see the code below). I made a few typos along the way. But even when I think I typed everything correctly, I'm still getting an error.
Karas-Computer:~ root# netstat -nr
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 4 5 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 10 1798 lo0
169.254 link#4 UCS 0 0 en0
192.168.1 link#4 UCS 1 0 en0
192.168.1.1 link#4 UHLW 3 0 en0
192.168.1.101 127.0.0.1 UHS 0 0 lo0
192.168.3 link#4 UC 0 0 en0
Internet6:
Destination Gateway Flags Netif Expire
::1 ::1 UH lo0
fe80::%lo0/64 fe80::1%lo0 Uc lo0
fe80::1%lo0 link#1 UHL lo0
fe80::%en0/64 link#4 UC en0
fe80::20d:93ff:fe76:ce28%e n0 0:d:93:76:ce:28 UHL lo0
ff01::/32 ::1 U lo0
ff02::/32 ::1 UC lo0
ff02::/32 link#4 UC en0
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.3 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.224 gw 192.168.3 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.224 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.240 netmask 255.255.255.240 gw192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root#
Karas-Computer:~ root#
Karas-Computer:~ root# netstat -nr
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.1.1 UGSc 4 5 en0
127 127.0.0.1 UCS 0 0 lo0
127.0.0.1 127.0.0.1 UH 10 1798 lo0
169.254 link#4 UCS 0 0 en0
192.168.1 link#4 UCS 1 0 en0
192.168.1.1 link#4 UHLW 3 0 en0
192.168.1.101 127.0.0.1 UHS 0 0 lo0
192.168.3 link#4 UC 0 0 en0
Internet6:
Destination Gateway Flags Netif Expire
::1 ::1 UH lo0
fe80::%lo0/64 fe80::1%lo0 Uc lo0
fe80::1%lo0 link#1 UHL lo0
fe80::%en0/64 link#4 UC en0
fe80::20d:93ff:fe76:ce28%e
ff01::/32 ::1 U lo0
ff02::/32 ::1 UC lo0
ff02::/32 link#4 UC en0
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.3 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.96 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.224 gw 192.168.3 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.96 netmask 255.255.255.224 gw 192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root# route add -net 209.220.186.240 netmask 255.255.255.240 gw192.168.1.1 dev en0
route: bad address: netmask
Karas-Computer:~ root#
Karas-Computer:~ root#
Hi kara334,
Why don't you try
route add -net 209.220.186.240/24 gw192.168.1.1 dev en0
just to see if that works and that change 24 to whatever you need.
Hope that will help.
Miro
Why don't you try
route add -net 209.220.186.240/24 gw192.168.1.1 dev en0
just to see if that works and that change 24 to whatever you need.
Hope that will help.
Miro
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I ended up dropping this class and forgot I had a question open. Sorry for the late points.
Kara
Kara
route add -net 209.220.186.96 netmask 209.220.186.240 gw <destination_gateway> dev en0
problem is, you need an ip address to be your gateway to the new network. maybe it's your default gateway anyways? but you need to tell the route command that ip in order to make it work.