手动给Mac(苹果)电脑,添加Nat,共享Internet。 - XiZi's Blog

手动给Mac(苹果)电脑,添加Nat,共享Internet。

Xizi posted @ 2012年8月01日 20:42 in Server with tags mac 苹果 Lion 手动 NAT NATD Moutain Lion 苹果电脑 共享 , 15013 阅读

费了半天劲,算是搞定了。

废话不多说,直接看命令吧!(好吧,其实这个是系统启动项目脚本(在/Library/StartupItems里面))

#!/bin/sh

. /etc/rc.common

function enipfw() #添加防火墙规则
{
    ipfw -f flush
    ipfw add allow all from any to me ssh
    ipfw allow all from any to me http
    ipfw allow all from any to me https
    ipfw add allow all from any to me openvpn
    ipfw add allow all from any to me ftp
    ipfw add 90 allow all from any to me 5900
    ipfw add divert natd all from any to any via en0
    ipfw add pass all from any to any
}

ConsoleMessage "NATD SYSTEM START ITEM."

  case $1 in
    start)
      ConsoleMessage "Starting NATD"
      sysctl -w net.inet.ip.forwarding=1 #设置网关
      natd -s -m -d -n en0 -dynamic #启动Nat
      enipfw
      sysctl -w net.inet.ip.fw.enable=1 #开启防火墙
      ;;
    stop)
      ConsoleMessage "Stopping NATD"
      sysctl -w net.inet.ip.forwarding=0
      killall natd
      ipfw -f flush
      sysctl -w net.inet.ip.fw.enable=0
      ;;
    restart)
      ConsoleMessage "Restarting NATD"
      killall natd
      sleep 10
      sysctl -w net.inet.ip.forwarding=1
      enipfw
      sysctl -w net.inet.ip.fw.enable=1
      ;;
  esac

如果你想让它随机启动,那么可以这么办

在/Library/StartupItems目录下建立目录NATD

在NATD目录下新建NATD文件,内容为以上内容。

在NATD目录先新建配置文件(StartupParameters.plist),内容如下:

{
  Description     = "NATD";
  Provides        = ("NATD");
  Requires        = ("Network");
  OrderPreference = "none";
  Messages        =
    {
      start       = "Starting NATD";
      stop        = "Stopping NATD";
      restart     = "Restarting NATD";
    };
}

OK, 完成以上工作可以修复文件夹权限并启动NATD服务了。

sudo chown -R 0:0 /Library/StartupItems/NATD #修复所有者
sudo chmod -R 755 /Library/StartupItems/NATD #修复权限
sudo SystemStarter -vd start NATD #启动服务
Avatar_small
celeb networth 说:
2021年8月07日 00:19

Do you know the net worth of your favorite actor, singer or any celebrity? There is a website which contains all information about celebrity networth for everyone.

Avatar_small
Harry 说:
2021年12月16日 03:19

Believe it or not, it is the type of information I’ve long been trying to find. It matches to my requirements a lot. Thank you for writing this information. 엔트리파워볼

Avatar_small
Harry 说:
2022年1月09日 08:48

Impressive web site, Distinguished feedback that I can tackle. Im moving forward and may apply to my current job as a pet sitter, which is very enjoyable, but I need to additional expand. Regards. 클레오카지노 주소

Avatar_small
Harry 说:
2022年1月14日 00:31

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. pre post seo article rewriter

Avatar_small
Harry 说:
2022年1月23日 21:44

Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also judi qiu qiu online

Avatar_small
faddy 说:
2022年5月21日 00:35

I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing. Nft opensea

Avatar_small
faddy 说:
2022年5月24日 02:48

Very interesting blog. Alot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definately interested in this one. Just thought that I would post and let you know. 먹튀검증커뮤니티

Avatar_small
먹튀사이트 说:
2022年5月25日 22:05

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. 먹튀사이트

Avatar_small
faddy 说:
2022年5月31日 23:29

I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. nft opensea

Avatar_small
faddy 说:
2022年6月03日 23:13

Great content material and great layout. Your website deserves all of the positive feedback it's been getting. 모바일바둑이

Avatar_small
JACK 说:
2022年6月13日 03:38

toner cartridges canada MVP Ink & Office is a one-stop online shop that provides the best Canadian-made print products. We provide printer inks, toner cartridges, ... https://mvpinkandoffice.com/

Avatar_small
dark web/deep web/d 说:
2022年8月21日 00:54

If a company seems too good to be true, it probably is. Scam artists thrive on people who are looking for easy ways to make money.  dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月21日 01:49

Some of the programs and websites offering this service may try to sell you something, even if they aren't really legitimate. deep web

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:12

And if you don't have a lot of friends on any of these sites to recruit, then you can't expect to make money.  dark web sites

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:34

So can I make money with links? The answer is yes, you can but it's not easy. It takes time and effort and hence, not many people can do it. dark web links

Avatar_small
dark web/deep web/d 说:
2022年8月21日 02:52

The more links you have, the more visitors you can attract and the more money you can make. However, you need to make sure that you are only working with legitimate companies or individuals.  dark web

Avatar_small
dark web/deep web/d 说:
2022年8月21日 03:09

You will quickly find that there are hundreds of thousands of companies you can join and become an affiliate for. The key is to find the affiliate programs that offer the products or services that appeal to you and then concentrate your efforts on these companies. work from home jobs

Avatar_small
dark web/deep web/d 说:
2022年8月21日 03:27

When you have found an appropriate seller, the next step in your quest for success with affiliate marketing is to set up a simple website that displays the products or services offered by your selected companies. affiliate marketing success

Avatar_small
Imamia Quran Academy 说:
2023年8月21日 11:45

Nicely presented information in this post, I prefer to read this kind of stuff. The quality of content is fine and the conclusion is good. Thanks for the post. I am from Imamia Quran Academy. Online Shia Quran Madrasa is second to none in providing education to Shia women’s. So our center has selected Shia Female Quran teacher with higher education from Madrasas.

Avatar_small
Imamia Quran Academy 说:
2023年8月21日 11:48

Hi, first of all, thank you for all this information. I really love your story. You have very useful information; I am from Imamia Quran Academy. Online Shia Yassarnal Quran is the source to learn Arabic letters and diacritics. One, including both kids and adults, must necessarily learn the basics for the correct recitation of the Quran. Join our Online Shia Quran Academy now, and Start your free 3 days Trial.

Avatar_small
Imamia Quran Academy 说:
2023年8月21日 11:55

Thanks for sharing this interesting blog with us. It’s really very nice and Useful Information. I am for Imamia Quran Academy. They can now Read Shia Quran Tajweed Online from authentic experts while sitting in their homes at their most feasible time.

Avatar_small
Imamia Quran Academy 说:
2023年8月21日 11:58

This is the suitable blog for anybody who needs to seek out about this topic. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I am from Imamia Quran Academy. Our Academy connects with students from all across the globe to inculcate true Islamic teachings in the scheduled Online Shia Quran Classes for Adults.

Avatar_small
hkseo 说:
2023年9月22日 21:52

Everything has its value. Thanks for sharing this informative information with us. GOOD works! Delaware incorporation package

Avatar_small
seo service UK 说:
2023年11月01日 21:25

I am very happy to finally read about the Thank you very much. Your post was of great help to me. If you are interested in the column I wrote, please visit my site . You’re brilliant! Thank you! I experience the beneficial data you offer for your articles. Fantastic blog! I dont assume ive visible all the angles of this situation the way youve pointed

Avatar_small
yitzchak 说:
2023年12月02日 23:21

Thank you for your submit and also fantastic suggestions.. also My partner and i furthermore believe work will be the main aspect of acquiring accomplishment. UFABETรับเครดิตฟรีแจกโบนัสเยอะ

Avatar_small
UFABETเว็บแทงบอลแนะน 说:
2023年12月07日 02:26

I would say that this is a a great post of a great person, i'm pleased to see this. UFABETเว็บแทงบอลแนะนำ

Avatar_small
yitzchak 说:
2023年12月09日 22:32

Whoa! Precisely what a close look opener this specific article have been to me. A lot loved, added, My spouse and i can’t loose time waiting for additional! ultra panda 777

Avatar_small
dshdsd 说:
2023年12月16日 04:39

"Looking for a comfortable chair for the office?if you want to read more visit: office chairs karachi At Profine furniture you can easily buy high quality office chairs online in a wide range. We have all types of office chairs for sale in modern design. read more : office chairs karachi "

Avatar_small
dshdsd 说:
2023年12月16日 05:14

Are you seeking cutting-edge architectural visualization services that transform your design concepts into stunning 3D realities? Our team specializes in 3d visualization service 3d visualization service

Avatar_small
seo 说:
2023年12月23日 01:15

Explore the vibrant culture and hidden gems of Daegu Trino with our comprehensive guide. From historic landmarks to local cuisine, discover the essence of this South Korean city. Uncover travel tips and must-see attractions to make your Daegu Trino experience unforgettable. Plan your journey with our expert insights today!" 대구 쓰리노

Avatar_small
sfse 说:
2023年12月26日 03:17

SecuredSuccess Retreat: Find success in secure gaming at SecuredSuccess Retreat, a Toto site fortified against scams. Meticulously chosen for safety, we provide a secure playground. With a proven operational history, substantial capital, and efficient withdrawals, your gaming satisfaction is our priority. 토토사이트 추천

Avatar_small
aaaaa 说:
2024年1月02日 03:46

Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks โปรโมชั่น ufabet

Avatar_small
tytt 说:
2024年1月02日 22:21

I am incapable of reading articles online very often, but I’m happy I did today. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing. ทางเข้า ufabet เว็บตรง

Avatar_small
seo 说:
2024年1月03日 03:40

New web site is looking good. Thanks for the great effort. ufabet.com ทางเข้า

Avatar_small
seo 说:
2024年1月03日 23:43

I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well. ufabet ไม่มี ขั้น ต่ํา

Avatar_small
tytt 说:
2024年1月04日 03:04

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. ufabet.com ทางเข้า มือถือ

Avatar_small
dbyfgasertu 说:
2024年1月04日 03:29

Fantastic blog! Do you have any tips and hints for aspiring writers? I’m planning to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many options out there that I’m completely overwhelmed .. Any suggestions? Many thanks! ufabet.com ทางเข้า มือถือ

Avatar_small
seo 说:
2024年1月10日 02:57 This is a great article thanks for sharing this informative information. I will visit your blog regularly for some latest post. I will visit your blog regularly for Some latest post. UFABETแทงบอลกินค่าน้ำ
Avatar_small
rse 说:
2024年1月11日 03:49

I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. <a href="https://www.dhruva-automation.com/%E0%B8%AA%E0%B8%A1%E0%B8%B1%E0%B8%84%E0%B8%A3%E0%B9%81%E0%B8%97%E0%B8%87%E0%B8%9A%E0%B8%AD%E0%B8%A5%E0%B8%9F%E0%B8%A3%E0%B8%B5ufabet/">สมัครแทงบอลฟรีUFABET</a>

Avatar_small
seo 说:
2024年1月14日 01:24

This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. UFABETเว็บพนันบอลที่นิยม

Avatar_small
tytt 说:
2024年1月16日 00:15

Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that. Bilskrot Göteborg

Avatar_small
tytt 说:
2024年1月16日 00:27

ery nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. เข้าสู่ระบบ ufa191

Avatar_small
seo 说:
2024年1月16日 01:11

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. UFABETสมัครเว็บแทงบอลออนไลน์รับยูสเซอร์ฟรี

Avatar_small
DRFTGYH 说:
2024年1月16日 23:22

Keep up the good work , I read few posts on this web site and I conceive that your blog is very interesting and has sets of fantastic information. 홍대룸싸롱

Avatar_small
DRFTGYH 说:
2024年1月19日 22:11

Thankyou for this wondrous post, I am glad I observed this website on yahoo. 우리카지노

Avatar_small
seo 说:
2024年1月22日 22:12

You delivered such an impressive piece to read, giving every subject enlightenment for us to gain information. Thanks for sharing such information with us due to which my several concepts have been cleared. UFABETพนันบอลออนไลน์ฟรีถูกกฏหมาย

Avatar_small
DRFTGYH 说:
2024年1月27日 21:26

Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. UFABETเข้าสู่ระบบไม่มีค่าธรรมเนียม

Avatar_small
DRFTGYH 说:
2024年1月31日 23:39

I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. slot indonesia

Avatar_small
Online Content Remov 说:
2024年2月04日 20:40

Thank you for taking the time to publish this information very useful! Ibis Bangkok

Avatar_small
rse 说:
2024年2月05日 23:17

Thank you for taking the time to publish this information very useful! <a href="https://bildemontering-goteborg.bilskrot.tips/">Skrota bilen Göteborg</a>

Avatar_small
Skrota bil Göteborg 说:
2024年2月06日 01:51

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. Bilskrot Göteborg

Avatar_small
DRFTGYH 说:
2024年2月10日 23:40

This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff. personal trainers Casselberry

Avatar_small
DRFTGYH 说:
2024年2月12日 21:05

If more people that write articles really concerned themselves with writing great content like you, more readers would be interested in their writings. Thank you for caring about your content. https://original.newsbreak.com/@eric-hancock-1751173/3307982486470-home-wi-fi-how-to-protect-yourself-from-hackers

Avatar_small
DRFTGYH 说:
2024年2月18日 00:42

Looking for a reliable SBOBET agent in Indonesia? Choose SBOBET88888 for easy account setup, quick deposits, and withdrawals within 5 minutes. Rely on our 24/7 expert support for a secure and trustworthy online football betting experience. sbobet88

Avatar_small
seo service UK 说:
2024年2月23日 22:15

I learn some new stuff from it too, thanks for sharing your information.

Avatar_small
aaaaa 说:
2024年2月24日 00:18

I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. tdtc

Avatar_small
DRFTGYH 说:
2024年3月01日 21:00

This is such a great resource that you are providing and you give it away for free. 10รับ100

Avatar_small
seo 说:
2024年3月15日 18:54

Fabulous post, you have denoted out some fantastic points, I likewise think this s a very wonderful website. I will visit again for more quality contents and also, recommend this site to all. Thanks. okvip

Avatar_small
seo 说:
2024年3月27日 23:14

Dive into a world of entertainment like never before with Edition Premium IPTV, offering a hassle-free setup and a plethora of channels. download edition premium iptv apk


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee