4

I have a typical laptop situation. When I'm at my desk, I want to be hooked up to the network via ethernet, and when I want to sit on the back deck, I'd like to be on wireless.

I have ethernet setup for a static ip address, no problem.

I can connect wirelessly, but only via dhcpclient. When I connect to the router, it assigns a conflicting ip address that makes my laptop fight with the kid's xbox. Not sure if it's the router or the xbox's fault, tbh.

Is it possible to connect wifi with a static ip address that I specify? I've read the man page for dhclient, ifconfig and read the faq. If the answer is in one of those documents, I've completely overlooked it a number of times.

Thanks in advance.


My current /etc/hostname.iwn0 looks like the following:

 inet 192.168.1.150 255.255.255.0 NONE
 nwid Portal
 wpakey passwordhidden

sudo sh /etc/netstart iwn0 then ping google.com yields:

 PING google.com (198.231.29.34): 56 data bytes
 ping: sendto: Network is down
 ping: wrote google.com 64 chars, ret=-1
 2 packets transmitted, 0 packets received, 100.0% packet loss

BUT, I can sudo dhclient iwn0 and then ping google:

 1 packets transmitted, 1 packets received, 0.0% packet loss
 round-trip min/avg/max/std-dev = 8.526/8.526/8.526/0.000 ms

So the example in the FAQ doesn't work, which is why I asked if there was something else that I might have missed.

1 Answers1

2

There is an example in the FAQ, which gives you a static IP address: you have to change your hostname.if(5) to something like

inet 10.0.0.157 255.255.255.0
nwid puffyuberalles
wpakey puffyguffy
  • I updated the original post since I don't have enough space in a comment to detail why what you sugguest doesn't work. – Philip McClure Aug 25 '15 at 14:18
  • 1
    I suspect that you don't have a defaultroute. You can either set in in /etc/hostname.iwn0 (using !route add default 192.168.1.1 or whatever your gateway is) or in /etc/mygate (see mygate(5)) –  Aug 25 '15 at 16:10
  • Thomas Weinbrenner, you're a genius! – Philip McClure Aug 26 '15 at 18:28