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

kara334Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kfullartonCommented:
Try this:

route add -net 209.220.186.96/27 gw <destination_gateway> en0
0
Gabriel OrozcoSolution ArchitectCommented:
ir, if that does not work, use

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.
0
kara334Author Commented:
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.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Gabriel OrozcoSolution ArchitectCommented:
netstat -nr

or

route -n

should show it to you.
0
kara334Author Commented:
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%en0            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#
0
kalifiCommented:
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
0
Gabriel OrozcoSolution ArchitectCommented:
yes. it is saying the "netmask" part is not part of the route package in your Macintosh...

try to use

 route add -net 209.220.186.240/19 gw192.168.1.1 dev en0
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kara334Author Commented:
I ended up dropping this class and forgot I had a question open. Sorry for the late points.

Kara
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.