Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25

Thread: SoftAP scripts

  1. #11
    Senior Member Nick_the_Greek's Avatar
    Join Date
    Jan 2010
    Location
    Greece
    Posts
    181

    Default

    hi, parrotface
    Since i haven't tried both scripts with a vista machine, i tried them both today and they work fine.
    I get internet through ppp0. I only got some IPv6 problems but internet works fine:
    I also add a MTU line i both scripts. You are missed something.
    BT4PF-ppp0(ADSL modem)-atheros (madwifi drivers).

  2. #12
    Senior Member
    Join Date
    Jun 2007
    Location
    UK
    Posts
    175

    Default

    hi
    I think the problem is with dhcp.conf or route as I now get IP address.
    Any chance of copy of dhcp.conf
    My setup internet on eth0 with gw 192.168.1.1
    Thanks again

    ps vista box ipconfig -all shows
    IPv4 .... 192.168.2.136 (Preferred)
    Subnet Mask .... 255.255.255.0
    Default Gateway ....192.168.1.1
    DHCP Server ... 192.168.1.129

  3. #13
    Senior Member Nick_the_Greek's Avatar
    Join Date
    Jan 2010
    Location
    Greece
    Posts
    181

    Default

    I am sure you are missing something. You can find dhcp.conf in the 1st post.
    Anyway, try this:
    Code:
    ddns-update-style ad-hoc;
    default-lease-time 600;
    max-lease-time 7200;
    subnet 192.168.1.128 netmask 255.255.255.128 {
    option subnet-mask 255.255.255.128;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.129;
    option domain-name-servers xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx;
    range 192.168.1.130 192.168.1.140;
    }
    Change xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx to your ISP's DNS servers.
    Also iptables should be:
    Code:
    # iptables
    iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
    iptables --append FORWARD --in-interface ath0 -j ACCEPT
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1
    echo 1 > /proc/sys/net/ipv4/ip_forward
    I am not a network-linux guru but I think dhcpd is running well. You can also check this:https://help.ubuntu.com/community/Wi...essPoint%29%29

  4. #14
    Senior Member
    Join Date
    Jun 2007
    Location
    UK
    Posts
    175

    Default

    Hi Nick
    I have been playing with ip tables etc and now put them back as your last reply
    Now got Vista box and Xp box connected to Soft AP using your last reply.
    Vista gets IP 192.168.2.130 (first to be connected)
    Then XP box gets 192.168.2.131
    can ping 192.168.2.129 from both boxes and ping each box from the other.
    So I think we can assume DHCP is working.
    Still cant get to 192.168.1.1 (internet gw)
    ipconfig on both boxes shows Default Gateway .. 192.168.1 .129 NOT 192.168.1.1 as I think it should any more ideas?
    This is best result I have ever managed, tried many scripts all with similar problems
    many thanks again

  5. #15
    Member floyd's Avatar
    Join Date
    Mar 2009
    Posts
    231

    Default

    Quote Originally Posted by Nick_the_Greek View Post
    I am sure you are missing something. You can find dhcp.conf in the 1st post.
    Anyway, try this:
    Code:
    ddns-update-style ad-hoc;
    default-lease-time 600;
    max-lease-time 7200;
    subnet 192.168.1.128 netmask 255.255.255.128 {
    option subnet-mask 255.255.255.128;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.129;
    option domain-name-servers xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx;
    range 192.168.1.130 192.168.1.140;
    }
    Change xxx.xxx.xxx.xxx, xxx.xxx.xxx.xxx to your ISP's DNS servers.
    Also iptables should be:
    Code:
    # iptables
    iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
    iptables --append FORWARD --in-interface ath0 -j ACCEPT
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1
    echo 1 > /proc/sys/net/ipv4/ip_forward
    I am not a network-linux guru but I think dhcpd is running well. You can also check this:https://help.ubuntu.com/community/Wi...essPoint%29%29
    change that to 192.168.1.1
    Auswaertsspiel

  6. #16
    Senior Member
    Join Date
    Jun 2007
    Location
    UK
    Posts
    175

    Default

    Hi
    Thanks my fault option commented out due to previous experiments.
    XP and Vista now show default gateway as 192.168.1.1 ok.

    Still have the problem cant ping 192.168.1.1 or connect to internet
    Does my soft AP box need bridge between 192.168.1.0 (eth0) and 192.168.2.129 (ath0) or is it routing table problem?

    thanks again

  7. #17
    Senior Member Nick_the_Greek's Avatar
    Join Date
    Jan 2010
    Location
    Greece
    Posts
    181

    Default

    @Floyd
    Maybe I messed up,but since I give at ath0:
    Code:
    ifconfig ath0 192.168.1.129 netmask 255.255.255.128
    route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.129
    and to IPtables:
    Code:
    iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
    iptables --append FORWARD --in-interface ath0 -j ACCEPT
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1
    then I must set in dhcp.conf ,option routers to 192.168.1.1 (eth0) and not to Rogue AP IP (ath0) which is 192.168.1.129?
    Networks is a pain in the ass. Maybe I misunderstand the whole think.But, its working for me. For sure I need more study.
    @parrotface
    You can give internet to your softAP with iptables or you can bridge eth0 and ath0. Sorry parrotface, but my knowledge is so limited. I am not a professional. I do love to learn and I do love linux. google and man command are my friends.
    P.S.
    Vista gets IP 192.168.2.130 (first to be connected)
    Then XP box gets 192.168.2.131
    not 192.168.1.130 and 192.168.1.131? Its a typo?

  8. #18
    Senior Member
    Join Date
    Jun 2007
    Location
    UK
    Posts
    175

    Default

    Hi Nick
    I am confused with your last post.
    my network is ok except Internet access.
    soft AP connected to router using eth0 cable ip 192.168.1.1
    Are you sugesting changing IP tables or can I change the routing.
    thanks again

  9. #19
    Senior Member Nick_the_Greek's Avatar
    Join Date
    Jan 2010
    Location
    Greece
    Posts
    181

    Default

    Hi parrotface
    To route or not to route? That is the question. Just kidding. Can you please post what are you doing line by line to see what is wrong? Can you please try this iptables:
    Code:
    iptables -P FORWARD ACCEPT
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

  10. #20
    Senior Member
    Join Date
    Jun 2007
    Location
    UK
    Posts
    175

    Default

    Hi Nick
    added last update for ip tables still cant ping 192.168.1.1 (eth0)
    copy of my script attached
    thanks again


    modprobe tun
    wlanconfig ath0 destroy
    wlanconfig ath0 create wlandev wifi0 wlanmode ap
    # essid Home_wifi, channel 11 at 54mbps
    iwconfig ath0 essid Home_wifi2-Thur3
    iwconfig ath0 channel 4
    iwconfig ath0 rate 54M
    echo "before sleep"
    sleep 3
    ifconfig ath0 up
    cd /root/
    # creating dhcpd.pid and changing group and own to dhcpd (no permision denied).
    cat /dev/null > /var/run/dhcpd.pid
    chgrp dhcpd /var/run/dhcpd.pid
    chown dhcpd /var/run/dhcpd.pid

    sleep 3
    ifconfig ath0 192.168.2.129 netmask 255.255.255.128
    route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.129
    route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1

    #kill all dns
    killall dnsmasq
    sleep 2
    #DHCP KillAll
    killall dhcpd3
    sleep 2
    # Cleanup our dhcpd.leases
    echo > '/var/lib/dhcp3/dhcpd.leases'

    sleep 2
    # create custom dhcpd.conf for WLAN
    cat > dhcpd.conf << EOF
    ddns-update-style ad-hoc;
    default-lease-time 1200;
    max-lease-time 7200;
    subnet 192.168.2.128 netmask 255.255.255.128 {

    option subnet-mask 255.255.255.128;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.1;
    option domain-name-servers 195.170.0.1, 195.170.2.2;
    range 192.168.2.130 192.168.2.140;
    }
    EOF
    echo "before start dhcp"
    sleep 2
    # start dhcp server for subnet
    dhcpd3 -cf dhcpd.conf ath0
    sleep 8

    ## solve our dns forwarder
    #dnsmasq restart

    ###########IP TABLES################

    # iptables cleanup
    iptables --flush
    iptables --table nat --flush
    iptables --delete-chain
    iptables --table nat --delete-chain

    # iptables
    iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE # gateway to ext. router
    iptables --append FORWARD --in-interface ath0 -j ACCEPT # rogue gateway
    #iptables -t nat -A PREROUTING -s 192.168.2.0/25 -d 192.168.2.0/25 -j DROP # protect LAN from WLAN (DROP/REJECT)
    iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1 # internet gateway

    iptables -P FORWARD ACCEPT
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

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

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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