Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: bridging wi-fi to ethernet, mythtv

  1. #1
    Join Date
    Sep 2010
    Beans
    11

    bridging wi-fi to ethernet, mythtv

    Hi all, I'm new here. I have made use of these forums before and found almost all my questions have been asked and answered already. Thanks to the *buntu community.

    This one has me stumped. I'm trying to set up my myth box (frontend & backend) to do all of the networking that I require. Here's my setup.


    eeebox B202 running mythbuntu 10.04


    eth0 static 192.168.1.10

    this is started at boot through /etc/network/interfaces and my myth-backend resides here.
    dnsmasq takes care of ip addresses for anything connecting to the ethernet port
    no problems here (so far)

    wlan0 dhcp 192.168.0.10 (IP assigned by my netcom wireless/3g router N3G007W)
    currently using NetManager to take care of the connection, but it may need to be disabled.......
    my router always gives it the same IP by the hardware address
    I can ssh into this address and access smb shares no problem.

    Wi-Fi Router 192.168.0.1
    issues dhcp in the range 192.168.0.11-50
    provides internet access and ssh / smb to my private network

    Laptop wi-fi dhcp 192.168.0.5x

    can ping, ssh, smb to 192.168.0.10
    myth-frontend (cannot connect to 192.168.1.10 through wi-fi)


    now I have several interconnected questions


    it seems a simple bridge interface will not work for wlan0 <--> eth0 because wi-fi packets aren't the same as ethernet packets. So I need to set up ip forwarding or routes. But I can not get my head around iptables.

    https://help.ubuntu.com/community/Router

    -or-

    Because I have trouble applying settings with iwconfig (due to NetManager taking control) this bridge method could work but I need to remove NetManager completely and start my wlan0 with /etc/network/interfaces

    http://newyork.ubuntuforums.org/showthread.php?t=1015641

    -or-

    I'm attacking this the wrong way completely
    or I need to use something like wicd


    Any Ideas out there?

  2. #2
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: bridging wi-fi to ethernet, mythtv

    Personally I never use bridging; I use IP routing instead. If you want the machine to route packets between interfaces, you'll need to check that IP forwarding is enabled in the Linux kernel, which by default it is not.

    Try this. First check to see if forwarding is enabled by typing the following in a Terminal:

    sudo cat /proc/sys/net/ipv4/ip_forward

    If you get a value of zero, forwarding is disabled.

    Now try fixing it on the fly by running the command

    sudo echo '1' > /proc/sys/net/ipv4/ip_forward

    Can you ping 192.168.1.10 now from a machine in 192.168.0.0/24?

    If that solves the problem, you can permanently enable forwarding by editing /etc/sysctl.conf. Find the lines that read

    Code:
    # Uncomment the next line to enable packet forwarding for IPv4
    #net.ipv4.ip_forward=1
    and remove the hash mark (#) from the first column of the net.ipv4.ip_forward line, then save the file.

    If that doesn't fix things, we'll need to probe deeper into things like your routing table, but let's try the simplest solution first.

  3. #3
    Join Date
    Sep 2010
    Beans
    11

    Re: bridging wi-fi to ethernet, mythtv

    Thanks for the reply. I'm following other issues on the forums. My goal is similar to the "xbox through laptop wi-fi" setup

    Quote Originally Posted by SeijiSensei View Post
    Try this. First check to see if forwarding is enabled by typing the following in a Terminal:
    Yes I have enabled IP forwarding

    Quote Originally Posted by SeijiSensei View Post
    Can you ping 192.168.1.10 now from a machine in 192.168.0.0/24?
    no, that's the problem.

    Quote Originally Posted by SeijiSensei View Post
    If that doesn't fix things, we'll need to probe deeper into things like your routing table, but let's try the simplest solution first.
    and that's the other problem; iptables is far from clear in my head. I have copied some lines of code from other threads and stuck them in the console, but have no idea what I'm doing.

    I think to make IP tables work properly I need to take control of my wlan0 and not let NetManager do it's thing.

    Then we go into the next layer of my problem, I can't set essid (or anything else) with iwconfig because NetworkManager is handling it and I'm a bit scared to completely remove it.

  4. #4
    Join Date
    Sep 2010
    Beans
    11

    Re: bridging wi-fi to ethernet, mythtv

    here's my settings


    Code:
    root@mythbox:~# sudo cat /proc/sys/net/ipv4/ip_forward
    1
    Code:
    root@mythbox:~# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    so I have no active routes, correct?


    so I do this

    Code:
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    and I end up with this
    Code:
    root@mythbox:~# iptables -t nat -L POSTROUTING
    Chain POSTROUTING (policy ACCEPT)
    target     prot opt source               destination         
    MASQUERADE  all  --  anywhere             anywhere
    Last edited by myth-eeebox-ben; September 26th, 2010 at 05:20 AM. Reason: extra info

  5. #5
    Join Date
    Mar 2007
    Location
    Outer Milky Way
    Beans
    Hidden!
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: bridging wi-fi to ethernet, mythtv

    Quote Originally Posted by myth-eeebox-ben View Post

    it seems a simple bridge interface will not work for wlan0 <--> eth0 because wi-fi packets aren't the same as ethernet packets.
    Not true.

    A simple bridge interface works fine, and I am using it now. The packets are the same.

    * Install bridge-utils to be able to create network bridges:

    sudo apt-get install bridge-utils

    * Edit /etc/network/interfaces:

    sudo nano /etc/network/interfaces

    The interfaces file should look like this after editing it:

    auto eth0
    iface eth0 inet manual
    #
    auto br0
    iface br0 inet dhcp
    #
    bridge_ports eth0 wlan0
    #
    # The loopback network interface
    auto lo
    iface lo inet loopback

    * Restart networking with:

    sudo /etc/init.d/networking restart

    From

    http://ubuntuguide.org/wiki/Ubuntu:L...faces_Bridging

    UbuntuGuide/KubuntuGuide

    Right now the killer is being surrounded by a web of deduction, forensic science,
    and the latest in technology such as two-way radios and e-mail.

  6. #6
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: bridging wi-fi to ethernet, mythtv

    Iptables just filters packets according to rules; it doesn't set up any routes. Your results show there are no filters in place.

    To see the routing table, enter "route -n" at the commmand prompt. My guess is that you have a route to the wifi router itself at 192.168.0.1, but no route to the 192.168.0.0/24 network. Do you have a routing table entry like this one:

    Code:
    192.168.0.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
    If not, try running the command

    sudo ip route add 192.168.0.0/24 via 192.168.0.1

    and see if that helps.

  7. #7
    Join Date
    Sep 2010
    Beans
    11

    Re: bridging wi-fi to ethernet, mythtv

    Firstly, thanks for the reply perspectoff, I was hoping a bridge would work, but it knocked out my eth0 static IP (which is essential for the mythbackend). Then I read somewhere about the packet size and that a bridge can't simply pass on the packets, depending on how the wi-fi firmware handles them.

    SeijiSensei
    Code:
    root@mythbox:~# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
    192.168.0.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0
    169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
    0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
    and I've added some other stuff to my previous post.

    any clues?

  8. #8
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: bridging wi-fi to ethernet, mythtv

    Quote Originally Posted by myth-eeebox-ben View Post
    Code:
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    Oh, you have a NAT rule? That could be the problem. You don't need to masquerade the packets if routing is set up correctly; in fact, it can break routing in many circumstances.

    Try "flushing" the nat table like this:

    sudo iptables -t nat -F

    then try pinging again.

    Masquerading is designed for situations where you want all the internal hosts on a network to appear as if their packets are all coming from a single address. The most common application is on firewall routers; NAT is used to enable the internal hosts with private addresses to talk to external hosts on the Internet. No matter which host you're using behind a NAT firewall, external hosts see your traffic as coming from the router's external address. That's not the situation you have here.
    Last edited by SeijiSensei; September 26th, 2010 at 05:44 AM.

  9. #9
    Join Date
    Sep 2010
    Beans
    11

    Re: bridging wi-fi to ethernet, mythtv

    trying the bridge method with


    Code:
    root@mythbox:~# cat /etc/network/interfaces 
    auto lo
    
    iface lo inet loopback
    
    auto eth0
    
    iface eth0 inet static
    address 192.168.1.10
    network 192.168.1.0
    netmask 255.255.255.0
    gateway 192.168.0.1
    up dnsmasq
    
    
    ###### wi-fi adapter wlan0 ######################
    
    auto wlan0
    iface wlan0 inet dhcp
    wireless-essid "benznet"
    #wireless-key xxxxxxxxx
    wireless-mode managed
    address 192.168.0.10
    netmask 255.255.255.0
    gateway 192.168.0.1
    up sh /etc/network/setwlan-post.sh
    ###########pre-up iptables-restore < /etc/iptables.rules
    
    ####### end of wi-fi ###################
    
    auto br0
    iface br0 inet dhcp
    #address 192.168.0.2
    #network 192.168.0.0
    #netmask 255.255.255.0
    #gateway 192.168.0.1
    bridge_ports wlan0 eth0
    #up \
    #/sbin/iwconfig wlan0 essid benznet && \
    #/sbin/iwconfig wlan0 mode managed


    gives me
    Code:
    root@mythbox:~# ifconfig
    br0       Link encap:Ethernet  HWaddr 00:22:43:45:67:5a  
              inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
              inet6 addr: fe80::222:43ff:fe45:675a/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:72 errors:0 dropped:0 overruns:0 frame:0
              TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:7291 (7.2 KB)  TX bytes:9415 (9.4 KB)
    
    eth0      Link encap:Ethernet  HWaddr 00:23:54:c1:f9:af  
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:27 Base address:0x2000 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:65684 errors:0 dropped:0 overruns:0 frame:0
              TX packets:65684 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:15317620 (15.3 MB)  TX bytes:15317620 (15.3 MB)
    
    wlan0     Link encap:Ethernet  HWaddr 00:22:43:45:67:5a  
              inet6 addr: fe80::222:43ff:fe45:675a/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:31899 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4449 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:6823233 (6.8 MB)  TX bytes:432947 (432.9 KB)
              Interrupt:17
    so it's knocked out the ip address on eth0 and wlan0, and has given 192.168.0.10 to br0
    I can still ssh into 192.168.0.10 (eeebox in hosts) but now Myth can't connect to the backend.... not good.

  10. #10
    Join Date
    Sep 2010
    Beans
    11

    Re: bridging wi-fi to ethernet, mythtv

    Quote Originally Posted by SeijiSensei View Post
    Oh, you have a NAT rule? That could be the problem.
    ok, I see that I don't need masquerading

    so I've gotten rid of the br0 crap, fresh boot, and myth works again

    now I do
    Code:
    sudo iptables -t nat -F
    and
    Code:
    sudo ip route add 192.168.0.0/24 via 192.168.0.1
    and I can't ping 192.168.1.10 from wi-fi

    I can't ping out using the eth0 interface
    Code:
    root@mythbox:~# ping -I 192.168.1.10 192.168.0.1
    PING 192.168.0.1 (192.168.0.1) from 192.168.1.10 : 56(84) bytes of data.
    ^C
    --- 192.168.0.1 ping statistics ---
    7 packets transmitted, 0 received, 100% packet loss, time 5999ms
    but i can ping out through wi-fi
    Code:
    oot@mythbox:~# ping -I 192.168.0.10 192.168.0.1
    PING 192.168.0.1 (192.168.0.1) from 192.168.0.10 : 56(84) bytes of data.
    64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.53 ms
    64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.60 ms
    64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.14 ms
    ^C

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •